Advertisement
Guest User

Untitled

a guest
May 24th, 2015
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.63 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. set -- 1 1 1 1 1 1 1 1 1 1
  5.  
  6. read -p "what is P's value? " num
  7.  
  8. P=$num
  9. #lets say 3
  10. echo $P
  11. # 3
  12. sub=$((10-$P))
  13. # 7
  14. echo $sub
  15. # 7
  16.  
  17. while (($1<1000))   # if its less then 1000 its true
  18.  
  19. do
  20.  
  21.     # set -- $1 $2 $(($1+$2)) ####  original version
  22.     set -- $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $(($"($sub)" + $10)) # 11th iteration is supose to be $10 plus $7 making $11 = 2
  23.     printf " %d" $1     # print me digits of what ever value $1 is
  24.     shift               # shift focus to the left 1 place from $3 to $2 in the original
  25.  
  26.     # disired output needs to be 1 2 3 4 5 7 10 14 19 26 ect... in this example above
  27.  
  28.  
  29. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement