LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Bash Shell Scripts (https://www.linuxquestions.org/questions/programming-9/bash-shell-scripts-17152/)

Anthony 03-27-2002 07:05 PM

Bash Shell Scripts
 
How do I write a bash shell script that accepts a positive number as a command line parameter to the script and outputs to a file the numbers from 0 to that positive number?

Any help would be appreciated.

acid_kewpie 03-27-2002 07:16 PM

ok, i'm 97% sure this is homework, in which case, we are NOT here to do your schoolwork for you, so do NOT read the bit below.
Code:

echo counting to $1
NUM=0
while [ $NUM -le $1 ]
do
echo $NUM
NUM=$(($NUM + 1))
done

hmm, i'm bored...

Manish 03-29-2002 04:29 AM

Quote:

Originally posted by acid_kewpie
ok, i'm 97% sure this is homework, in which case, we are NOT here to do your schoolwork for you, so do NOT read the bit below.
lol :D


All times are GMT -5. The time now is 01:50 AM.