shell script error expecting “do”

后端 未结 2 1492
心在旅途
心在旅途 2021-01-31 10:37
#!/bin/sh
while true ; do
echo \"WTF\"
done

This is giving a syntax error: syntax error: unexpected end of file (expecting \"do\")

I also tried

2条回答
  •  别那么骄傲
    2021-01-31 11:13

    Give this a try:

    #!/bin/sh
    while [ true ]
    do
        echo "WTF"
    done
    

    Please pay special attention to the spaces in the line 'while [ true ]'

提交回复
热议问题