Any idea of what the problem could be?
My code is:
#!/bin/bash
while :
do
echo \"Press [CTRL+C] to stop..\"
sleep 1
done
Saved it a
Sometimes this error happens because of unexpected CR characters in file, usually because the file was generated on a Windows system which uses CR line endings. You can fix this by running os2unix
or tr
, for example:
tr -d '\015' < yourscript.sh > newscript.sh
This removes any CR characters from the file.