我试图将echo输出分配给ssh中的变量,但低于输出
file_temp='/tmp/diskIO_temp.log'
file_temp包含
2月25日03:06:09 testserver sde
2月26日03:06:09 testserver sde
ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null test@testserver "IFS=$'\n'; cat $file_temp | while read line; do disk= `echo \$line`; echo \": disk : \$disk :\";done"
输出:
: disk : :
: disk : :
预期输出:
Feb 25 03:06:09 testserver sde
Feb 26 03:06:09 testserver sde
答案 0 :(得分:0)
尝试以下
ssh -t -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null test@testserver "IFS=$'\n'; file_temp=/tmp/diskIO_temp.log ; cat \$file_temp | while read line; do disk=\$line ; echo \": disk : \$disk :\";done"