Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

echo without space..?

Status
Not open for further replies.
Oct 22, 2001
215
US
Hi
I am concatinating 3 variables into a file. It works fine:
a='I'
b='a'
c='m'

echo $a $b $c >fileresult
: I a m

Would it be possible to take the space out between $b and $c so that I get
: I am
Thanks
 
Hi:

Most modern *nixs such as Solaris has the printf command. Use it instead of the echo:

printf "%s %s%s" $a $b $c > fileresult

Regards,

Ed
 
Thanks a lot... It worked. I used it for the space and also with the "%s\n" I was able to use it for new line since I am using this statement inside a loop from shell. Any way, It helped. Thanks a lot [smile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top