bash script error
I have got a script which will decrypt a GPG encrypted password file and logs me in to the server automatically using ssh key. But it's giving an error since I added a server "venus" which is an exception to the generic rules.
Code:
1 if [ -f $DECRYPT ]; then Code:
syntax error near unexpected token `else' |
You have two else statements for one if. (Lines 5 & 8) Should one of them be an elif?
|
Thanks for your reply. I have just substituted the else in line 5 with elif and also the else in line 8 with elif. But still getting the same error.
|
Hi,
elif should be followed by an expression: if [ something ] then .... elif [ something else ] .... else .... fi Hope this helps. |
Things were clearly not matched up right. Substituting elif for both elses would clearly not be right either, as well as elif requires a condition to test.
I haven't really figured out what you are trying to do, but making another wild stab at it, is the following what you were trying to do? Code:
if [ -f $DECRYPT ]; then |
Thanks guys. I have solved the problem. Here's what the solution looks like -
Code:
1 if [ -f $DECRYPT ]; then |
All times are GMT -5. The time now is 05:14 PM. |