What does 'cd -' stand for?

后端 未结 8 1215
星月不相逢
星月不相逢 2020-12-13 05:41

In a bash shell script today I noticed the below command at the end of the script. I know what is cd but I am unaware of the significance of a dash after it.

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 06:04

    If a single dash is specified as the argument, it will be replaced by the value of OLDPWD.

    The OLDPWD is set by cd command and it is the previous working directory.

提交回复
热议问题