ellyheetov / troubleshooting

공부 과정 중 발생하는 모든 문제들을 Issues에 기록한다.
0 stars 0 forks source link

Shell Script : Syntax error: Bad for loop variable #18

Closed ellyheetov closed 3 years ago

ellyheetov commented 3 years ago

bash version : GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

#!/bin/bash
for ((i=1;i<=16;i++));
do
   mkdir "day$i"
done

실행명령어

$ sh ./exshell

결과

./exshell: 2: Syntax error: Bad for loop variable

도대체 왜 for문에서 에러가 발생할까?

ellyheetov commented 3 years ago

삽질 1)

!/bin/bash 를 #!/bin/sh 로 바꾼다

-> 해결 X

ellyheetov commented 3 years ago

실행 명령의 오류였다.

$ ./exshell

로 실행하면 해결된다.