Find the answer to your Linux question:
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 ...
  1. #1
    Linux 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 executing
    Switched to Scripting

  2. #2
    Linux Newbie X.Cyclop's Avatar
    Join Date
    May 2006
    Location
    Israel
    Posts
    143
    Try:
    Code:
    test=ssh hostname cat /proc/cpuinfo |grep -i 'model name'
    "Don't think about the work, think about the benefit"

    Leonardo Juszkiewicz

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...