what does '$?' mean in a shell script?

前端 未结 6 1903
抹茶落季
抹茶落季 2021-02-02 00:31

I came across a shell script that contains a statement like,

if [ $val -eq $? ]

What does $? mean here?

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 00:56

    ls *.* or ls would produce the same result. Meaning show zero or more files with any extension in the current directory.

    echo $? would display the exit status. If at least one file is displayed from the last command ,the exit status would be zero(success).

提交回复
热议问题