📄 ex17.sh
字号:
#!/bin/bash# Call this script with at least 10 parameters, for example# ./scriptname 1 2 3 4 5 6 7 8 9 10MINPARAMS=10echoecho "The name of this script is \"$0\"."# Adds ./ for current directoryecho "The name of this script is \"`basename $0`\"."# Strips out path name info (see 'basename')echoif [ -n "$1" ] # Tested variable is quoted.then echo "Parameter #1 is $1" # Need quotes to escape #fi if [ -n "$2" ]then echo "Parameter #2 is $2"fi if [ -n "$3" ]then echo "Parameter #3 is $3"fi # ...if [ -n "${10}" ] # Parameters > $9 must be enclosed in {brackets}.then echo "Parameter #10 is ${10}"fi echo "-----------------------------------"echo "All the command-line parameters are: "$*""if [ $# -lt "$MINPARAMS" ]then echo echo "This script needs at least $MINPARAMS command-line arguments!"fi echoexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -