0

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 included 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

1 Answer 1

5

Your last line should be fi instead of if.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.