if condition
I am trying to compare two strings using the following code but it gives me error. I have tried couple of options but it does not work.
The code is read -p "Do you want to continue ? Y/N - " opt if ["$opt"== "N"];then do something fi and the error I get ./newtest.sh: line 20: [N==: command not found I have tried this way as well #!/bin/bash S1='string' S2='String' if [ $S1=$S2 ]; It still gives the same errror. Any suggestions? Thanks, |
Quote:
Code:
if [ "$opt"== "N" ];then |
Thanks for the quick reply.
Last time (as in my previous thread) it gave an error due to space and in this case it gives error if there is a space. The spaces in "IP = ..." could be the problem. When you initialise variables in Bash, you must not use spaces. Your help is very much appreciated. |
All times are GMT -5. The time now is 10:23 AM. |