0
任何人都可以解释我为什么解释的bash变量assignement输出
VBB:~ me$ test="zut"; echo $test; echo $test > test2; echo "echo test " $test2
输出为:
zut
echo test
VBB:~ me$
,而不是
zut
echo test zut
VBB:~ me$
任何人都可以解释我为什么解释的bash变量assignement输出
VBB:~ me$ test="zut"; echo $test; echo $test > test2; echo "echo test " $test2
输出为:
zut
echo test
VBB:~ me$
,而不是
zut
echo test zut
VBB:~ me$
因为echo $test > test2
输出写入一个文件名为test2的。
这组命令是做你所期望的:
test="zut"; echo $test; test2=$test; echo "echo test " $test2
加入到第一个答案,你可以指定文件的变量中的值。
echo "$var" ; var= more test2
所以,你可以得到的字符串,你写的文件test2的
后