How to test for if two files exist?

前端 未结 4 1980
耶瑟儿~
耶瑟儿~ 2021-02-02 07:11

I would like to check if both files exist, but I am getting

test.sh: line 3: [: missing `]\'

Can anyone see what\'s wrong?

#!/b         


        
4条回答
  •  无人及你
    2021-02-02 07:25

    [[ is bash-specific syntax. For POSIX-compatible shells, you need:

    [ -f file1 ] && [ -f file2 ]
    

提交回复
热议问题