Simple loop
Can anyone tell me what's wrong with this script? It just won't run .. by the way, i'm running it from a mac terminal. thanks
#!/bin/bash read -p “How many times? “ N for ((i=0;i<N;i++)); do echo “Hello World!” done |
The editor you used on the Mac helpfully replaced the double-quotes with smart-quotes. You have to turn that feature off, or use a plain text editor.
|
Hi,
Quote:
- Do you get error messages? - Doesn't it loop? - Doesn't it ask the "How many times?" question? - .... ? Details, please! |
-bash: helloworld.sh: line 2: syntax error near unexpected token `('
done'(i=echo ?Hello World!?N: ` How do i turn the feature off? I'm using TextEdit |
Go to the TextEdit Preferences menu and uncheck the box for “Smart Quotes”.
You'll then need to retype the quotes. |
Hi,
I don't know what your default settings are, but maybe this will also help: Plain text editor for Mac OS X |
It's working now, thanks!!
|
You're welcome :)
BTW: Can you put up the [SOLVED] tag. first post -> Thread Tools -> Mark this thread as solved |
All times are GMT -5. The time now is 07:47 PM. |