Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

BASH - Need to echo for loop output to one line

$
0
0
I'm trying to echo the release version of some of our Linux servers. Typically I do these types of things by "catting" a text file with the host names, "ssh-ing" to the host and running my string.

This is what I've written
Code:

for i in `cat versions.txt` ; do echo $i ; ssh $i cat /etc/issue | grep release ; done
This works, but I get output like
Code:

ServerName
Red Hat Enterprise Linux Server release 5.6 (Tikanga)

I'm trying to get it to look like
Code:

ServerName Red Hat Enterprise Linux Server release 5.6 (Tikanga)
I've looked around the forums and messed with printf and echo -n but I can't seem to get the syntax right. Any help is appreciated.

Viewing all articles
Browse latest Browse all 16232

Trending Articles