ex11.sh
来自「Shall高级编程」· Shell 代码 · 共 49 行
SH
49 行
#!/bin/bashechoif test -z "$1"then echo "No command-line arguments."else echo "First command-line argument is $1."fiechoif /usr/bin/test -z "$1" # Equivalent to "test" builtin.# ^^^^^^^^^^^^^ # Specifying full pathname.then echo "No command-line arguments."else echo "First command-line argument is $1."fiechoif [ -z "$1" ] # Functionally identical to above code blocks.# if [ -z "$1" should work, but...#+ Bash responds to a missing close-bracket with an error message.then echo "No command-line arguments."else echo "First command-line argument is $1."fiechoif /usr/bin/[ -z "$1" ] # Again, functionally identical to above.# if /usr/bin/[ -z "$1" # Works, but gives an error message.# # Note:# This has been fixed in Bash, version 3.x.then echo "No command-line arguments."else echo "First command-line argument is $1."fiechoexit 0
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?