Here's a simple line from a bigger piece of code which is what I am confused about.
if [ $some_line == "text" ]
then
Then I went on to use the same code for another program that I was working on but the code didn't work UNLESS I changed "==" to "=". I've gone through a few threads here that suggests both of them act the same way so it doesn't matter if you use single or double equals.
if [ $some_line = "text" ]
then
So the first piece of code works on server1 but doesn't on server2 UNLESS I change it to "single equals". Both the servers have exactly the same environment.
Can anyone explain? Thanks!
EDIT - I am running the script as "bash myscript.sh" everytime.
sh script.sh
?bash script.sh
? Justscript.sh
? Something else?) and also show us the output ofls -l /bin/sh
on both machines. – terdon May 30 '18 at 11:40=
and==
would behave the same on both of them. – ilkkachu May 30 '18 at 11:49