当前位置: 技术问答>linux和unix
unix变量赋值问题?求大神解答!
来源: 互联网 发布时间:2017-05-01
本文导语: a=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " ` echo "$a" b=`echo "${a}"|wc -l` echo "$b" 执行结果:2 c=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur "|wc -l` echo "$c" 执行结果为:1 ...
a=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " `
echo "$a"
b=`echo "${a}"|wc -l`
echo "$b"
执行结果:2
c=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur "|wc -l`
echo "$c"
执行结果为:1
a=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " `
echo "$a"
执行结果为:5
5
echo`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " `
执行结果为:5 5
为什么会有这样的差异?变量的赋值过程是怎么样的?
echo "$a"
b=`echo "${a}"|wc -l`
echo "$b"
执行结果:2
c=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur "|wc -l`
echo "$c"
执行结果为:1
a=`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " `
echo "$a"
执行结果为:5
5
echo`db2 -x "select 5 from syscat.procedures fetch first 2 row only with ur " `
执行结果为:5 5
为什么会有这样的差异?变量的赋值过程是怎么样的?
|
方法C和方法D没有双引号,效果相同。