与tcsh的测试,这下在tcsh
所有的工作来完成各种结果:
alias t echo hello world # you may not actually need any quotes
alias u 'echo "hello world"' # nested quotes of different types
alias v echo\ \"hello\ world\" # escape everything
alias w echo '\;'hello'";"' world # quote/escape problem areas only
alias x 'echo \"hello world\"' # single quote and escape for literal "
alias y "echo "\""hello world"\" # unquote, escaped quote, quote ("\"")
alias z 'echo '\''hello world'\' # same goes for single quotes ('\'')
,以了解这些由shell来解释,无参数运行alias
:
% alias
t (echo hello world)
u echo "hello world"
v echo "hello world"
w (echo \;hello";" world)
x echo \"hello world\"
y echo "hello world"
z echo 'hello world'
圆括号中的任何内容都在子外壳中运行。如果你试图设置环境变量,这会很糟糕,但是大多数情况下是不相关的。
最后,这里就是例子实际上做:
% t; u; v; w; x; y; z
hello world
hello world
hello world
;hello; world
"hello world"
hello world
hello world
最后两个不需要引号。用单引号代替双引号怎么样? – 2008-12-20 03:19:39