bash script "unexpected end of file" in simple script
I have a script written in a file.
#!/bin/bash
if [ -f "/bin/uname" ]; then
OS=`/bin/uname`;
export OS="${OS}";
else
echo "Unable to detect OS - modify the appropriate .bashrc to support";
if
If I run it, I get the following error:
./temp.sh: line 9: syntax error: unexpected end of file
However, if I type the same script on bash prompt, it works.
(This piece of code is giving me nightmares. It is 开发者_如何学JAVAincluded in another large script which is failing due to these 6 lines. I put them in a separate script temp.sh and temp.sh gives the same error)!.
regards,
JP
Your last line should be fi
instead of if
.
精彩评论