What are the special dollar sign shell variables?

前端 未结 4 831
北海茫月
北海茫月 2020-11-22 00:44

In Bash, there appear to be several variables which hold special, consistently-meaning values. For instance,

./myprogram &; echo $!

wil

4条回答
  •  再見小時候
    2020-11-22 01:36

    Take care with some of the examples; $0 may include some leading path as well as the name of the program. Eg save this two line script as ./mytry.sh and the execute it.

    #!/bin/bash
    
    echo "parameter 0 --> $0" ; exit 0
    

    Output:

    parameter 0 --> ./mytry.sh
    

    This is on a current (year 2016) version of Bash, via Slackware 14.2

提交回复
热议问题