I need to write a VERY SIMPLE linux script for my class, but I'm doing something wrong (which is a matter of sintax I think) and have not been able to find it easily on google.
The program must put out on the screen the numbers from 0 till the value passed by the cmd line. For example, if you run ./script.sh 5 the program will output '1 2 3 4 5'. So I've used a while sentence, and my script looks like this:
The problem is in the line marked above, and I'm not sure how I should be doing this. Any help will be greatly appreciated (especially since I have to send it in tonight as latest)
The program must put out on the screen the numbers from 0 till the value passed by the cmd line. For example, if you run ./script.sh 5 the program will output '1 2 3 4 5'. So I've used a while sentence, and my script looks like this:
Code:
#!/bin/sh
num=0
while [ $num -ne $1 ]; do
num = $num + 1 <-------------------- THIS IS THE LINE WITH PROBLEMS
echo $num
done
The problem is in the line marked above, and I'm not sure how I should be doing this. Any help will be greatly appreciated (especially since I have to send it in tonight as latest)