Unix Shell - Re: strip off trailing+leading blanks

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > September 2006 > Re: strip off trailing+leading blanks





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: strip off trailing+leading blanks
Stephane Chazelas

2006-09-22, 7:27 am

On 21 Sep 2006 08:07:08 -0700, Michael Paoli wrote:
[...]
> $ var=' foo bar baz '
> $ echo X"$var"X
> X foo bar baz X
> $ read var << __EOT__
> $ echo X"$var"X
> Xfoo bar bazX
> $
>
> Also note that expr is also built-in to many shells.


No, it's not, and when it is such as in the original ash where
you had to change the compile option to have a builtin expr,
then it's different from the expr you're used to.

You need "read -r" above.

--
Stephane
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com