2: 为一列数据加但引号,逗号,并去掉空格
awk '{print "'\''",$1,"'\''",","}' MC.txt|sed s/[[:space:]]//g>MC.txt.new
------------------------------------
1: 去掉重复行:
sort -u myl
--------------------------------------
1:判断缺少参数:
name=${1:?"requires an argument" }
echo Hello $name
2: $* and $@
The $* and $@ differ only when enclosed in double quotes. When $* is enclosed within double quotes, the parameter list becomes a single string. When $@ is enclosed within double quotes, each of the parameters is quoted; that is, each word is treated as a separate string.
只有当用双引号引用时,这两者才有区别。 "$*"会返回一个串,由所有的参数共同组成。 "$@"会分别返回各个串,每个参数都是一个独立的串。
"$*"
|
Expands to a single argument (e.g., "$1 $2 $3")
|
"$@"
|
Expands to separate arguments (e.g., "$1" "$2" "$3")
|
3: id | nawk
–F'[=(]' '{print $2}'
awk 使用=或者(做为分隔符。
awk uses either an equal sign or an open parenthesis as field separator, extracts the user ID from the output
4:The null Command 空命令
name=Tom
if grep "$name" databasefile > /dev/null 2>&1
then
:
else
echo "$1 not found in databasefile"
exit 1
fi
5:
while true; do..... 可以这样紫来做判断的啊 .... 真真是....只能长叹一声,有本事你用中文自己开发个语言啊~
阅读(915) | 评论(0) | 转发(0) |