Results 1 to 2 of 2
am getting trailing line, how can I remove that, see below
$test = ssh hostname cat /proc/cpuinfo |grep -i 'model name'
echo "$test"
(standard input):model name : Intel(R) XEON(TM) CPU ...
- 04-07-2008 #1Linux Newbie
- Join Date
- Jan 2008
- Posts
- 114
How to remove trailing line in Shell
am getting trailing line, how can I remove that, see below
$test = ssh hostname cat /proc/cpuinfo |grep -i 'model name'
echo "$test"
(standard input):model name : Intel(R) XEON(TM) CPU 2.40GHz
<trailing line>
And when I am checking value in variable, nothing is there
if [ -n $test ]; then
echo "$test"
else
echo "Error"
fi
but nothing is happening, even else is also not executingSwitched to Scripting
- 04-09-2008 #2
Try:
Code:test=ssh hostname cat /proc/cpuinfo |grep -i 'model name'
"Don't think about the work, think about the benefit"
Leonardo Juszkiewicz


Reply With Quote