String comparison in bash. [[: not found

后端 未结 7 1381
故里飘歌
故里飘歌 2020-11-29 17:40

I am trying to compare strings in bash. I already found an answer on how to do it on stackoverflow. In script I am trying, I am using the code submitted by Adam in the menti

7条回答
  •  一整个雨季
    2020-11-29 18:28

    How you are running your script? If you did with

    $ sh myscript
    

    you should try:

    $ bash myscript
    

    or, if the script is executable:

    $ ./myscript
    

    sh and bash are two different shells. While in the first case you are passing your script as an argument to the sh interpreter, in the second case you decide on the very first line which interpreter will be used.

提交回复
热议问题