csh: usages
- special symbol
- scripts contant
#!/bin/tcsh echo \$_ : $_ echo \$0 : $0 echo \$1 : $1 echo \$\* : $* echo \$\# : $# echo \$\$ : $$ echo \$! : $! echo \$\? : $?
-
- run this script
% source test.csh a b c > $_ : source test.csh a b c > $0 : -tcsh > $1 : a > $* : a b c > $# : 3 > $$ : 18300 > $! : > $? : 0
- Get the executing script's path
- script name: test.csh
#!/bin/tcsh
set called=($_)
set envfile = `echo $called | awk '{print $2}'| xargs basename`
set path = `echo $called | awk '{print $2}'| xargs readlink -f | xargs dirname`
echo "envfile: $envfile"
echo "path: $path"
-
- run test.csh
% source test1.csh > envfile = test1.tcl > path = <the script's full path>

浙公网安备 33010602011771号