While loop Error in one line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting While loop Error in one line
# 8  
Old 12-24-2017
In fact, the second input line seems to be eaten away by the ssh session launched in the "command substitution" for the variable assignment
Code:
outp=`ssh -q node_name bootinfo -s $line`

Try the -n option to that ssh session.


EDIT: Rats ... beaten by a split second by MadeInGermany!
# 9  
Old 12-24-2017
Thanks guys... Really appreciated helping me out. Got a work around and it works fine.

Code:
Val=`ssh -q node_name lspv |egrep -w 'hdisk0|hdisk1'|awk '{print $1}'`

for z in $Val;do echo $z " " `ssh -q Node_name "bootinfo -s $z"`;done


Last edited by Scrutinizer; 12-25-2017 at 02:28 AM.. Reason: code tags
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting an unexpected newline in my while loop line-by-line feed

Hi, I'm trying to get a line returned as is from the below input.csv file in Bash in Linux, and somehow I get an unexpected newline in the middle of my input. Here's a sample line in input.csv $> more input.csv TEST_SYSTEM,DUMMY@GMAIL.COM|JULIA H|BROWN And here's a very basic while loop... (7 Replies)
Discussion started by: ChicagoBlues
7 Replies

2. Shell Programming and Scripting

While read line loop

Based on text file: PATH:/media/hdd/Media/Video/title1 FILE:/media/cache/281662-14.jpg PATH:/media/hdd/Media/Video/title2 FILE:/media/cache/281662-15.jpg PATH:/media/hdd/Media/Video/title3 FILE:/media/cache/281662-16.jpg PATH:/media/hdd/Media/Video/title4 FILE:/media/cache/281662-17.jpg... (12 Replies)
Discussion started by: TiedCone
12 Replies

3. Shell Programming and Scripting

Reading line by line from live log file using while loop and considering only those lines start from

Hi, I want to read a live log file line by line and considering those line which start from time stamp; Below code I am using, which read line but throws an exception when comparing line that does not contain error code tail -F /logs/COMMON-ERROR.log | while read myline; do... (2 Replies)
Discussion started by: ketanraut
2 Replies

4. Shell Programming and Scripting

Reading line in while loop

Hello Team, i have to read line by line in a while loop, and the input file has:. # The script will start cppunit test application to run unit tests. -LD_LIBRARY_PATH=$CPPUNIT_HOME/lib:\ +LD_LIBRARY_PATH=$VOBTAG/SS_UnitTest/lib:\ $VOBTAG/SS_BFD/BFDSCLI/build:\ ... (7 Replies)
Discussion started by: chandana hs
7 Replies

5. Shell Programming and Scripting

for loop with whole line using cat

Hi all, I need to create loop script to read full line and append a variable to each line. cat file I need the output like below 10.0.0.1,136 1 24 048800 id N4 No_Light 10.0.0.1,137 1 25 048900 id N4 No_Light 10.0.0.1,140 1 28 048c00 id N4 No_Light 10.0.0.1,262 1 38 048e80... (13 Replies)
Discussion started by: ranjancom2000
13 Replies

6. UNIX for Dummies Questions & Answers

One Line for loop in CRON

Hello, I'm trying to run a one line for loop from the CRON. This is the exact command /bin/bash for file in $(/bin/find /opt/local/edw_extract/logs -name "*.log"); do /bin/cat /dev/null > $file; done This will run from the command successfully. When I schedule this to run it will... (3 Replies)
Discussion started by: mhauff
3 Replies

7. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

8. Shell Programming and Scripting

for loop not working - syntax error at line 6: `end of file' unexpected

I have a file called test.dat which contains a b I have written a shell script called test.sh for i in `cat test.dat` do echo $i done When i run this script using sh test.sh I get this message - test.sh: syntax error at line 6: `end of file' unexpected What is the... (3 Replies)
Discussion started by: debojyoty
3 Replies

9. Shell Programming and Scripting

how to determine last line in a while do loop

Hey guy, I have a very simple question, I have the following script, while read $test do echo "this is $test" done < /testfile What I want is instead of printing "this is $test" for each line, I want the script to print out "this is last line" for last line, how should I do it? (10 Replies)
Discussion started by: fedora
10 Replies
Login or Register to Ask a Question