1、ls |tail >out1.txt
eg:
ps -ef | grep redis-server | grep -v grep | awk '{print $2}'
2、子shell法
output=$( ls |cat -n )
3、反引用:
output1=`ls|cat -n`
echo $output1
3.1
# cd `echo $JAVA_HOME`
3.2:a=echo $JAVA_HOME
cd $a
4、xargs
ps -ef | grep redis-server | grep -v grep | awk '{print $2}' | xargs ./test