Bash scripting unexpected operator

前端 未结 1 337
既然无缘
既然无缘 2020-12-06 10:43

I\'m writing script for git hook and have trouble with if statement inside while.

File:

#!/bin/sh
while read oldrev newref          


        
相关标签:
1条回答
  • 2020-12-06 10:50

    if [ "a" == "a" ] should be if [ "a" = "a" ].

    bash accepts == instead of =, but your /bin/sh probably isn't bash.

    So either change the == to =, or your shebang to #!/bin/bash

    0 讨论(0)
提交回复
热议问题