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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Korn Shell - Echo out a trailing space

Status
Not open for further replies.
Jan 19, 2000
57
0
0
US
Korn Shell. How the heck do you echo out a trailing space?

rmt="/dev/rmt1"
output=$(echo $rmt" ")

That's not working. It's gotta be something simple, I just can't figure it out.

Any help would be appreciated.

Thanks!
 
Hi

Actually that does echo out the trailing space, but is lost almost immediately. Use double quotes ( " ) around the whole evaluate thing :
Code:
output=[red]"[/red]$(echo $rmt" ")[red]"[/red]

Feherke.
 
That worked! Thank you very much! I'll be adding that to my bag of tricks.
 
[tt]output="${rmt} "[/tt]

gets you the same result as above I should think...



HTH,

p5wizard
 
Hi

First I started to post the same. But then I thought Mikeymac's example is too simple to be real, so maybe is just a simplified reproduction. That [tt]echo[/tt] in sub-process reminds me the pathname expansion :
Code:
[red]rmt='*.ext'[/red]

output="${rmt} "
Of course, if my theory is wrong and there is nothing expandable in rmt's value, p5wizard's suggestion is the preferred one.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top