I was trying to run a shell script and run it through Cygwin terminal in XP environment. The script I have written is as follows -
read -p "Enter Your name - " fname
if test "$fname" == "abcd"
echo "Thank you abcd"
When I am trying to run it, after taking the input it gives an error - ': not a valid identifier: read: `fname Though the commands are working fine when I am trying them in terminal. Any suggession plz. Thanks in advance...
It is a special character related problem. I used notepad++ editor to write the script initially, which adds some special character not supported by linux. You can either use dos2unix to convert it into linux format or just use cat > filename to create the file. Then you can edit the file in windows based editor as well.
I wonder what the solution was? :) I haven't used cygwin in a while. I'm curious to know what the problem was!