for some reason this:
#!/bin/bash
for ln in {1 2 3}; do
done
exit 0
produces the following error:
./Untitled-1.sh: line 3: syntax error near unexpected token done' ./Untitled-1.sh: line 3:
done'
can anyone tell me what i am doing wrong here?
CodePudding user response:
You need to do something in the loop. E.g.
echo "$ln"
That will also show you that the brace expansion doesn't use spaces to separate elements.
The correct syntax would be
for ln in 1 2 3 ; do
# or
for ln in {1,2,3} ; do