[oclug] How do I input in a (bash) shell script
2chulan at home.com
Sun Feb 25 18:03:19 EST 2001
Joe Burpee wrote:
> Josh Diakun wrote:
> > Let me get this straight you want to enter a string like... "hey does this
> > work" ...into a variable...what I posted should do so.
Sorry Josh, I didn't look at your solution cloesly enough...
> OK, but it don't think it will preserve leading or trailing whitespace.
> If that is a concern, it is safer to use `read' with no arguments. The
> complete input line then should be in "$REPLY":
> echo "Foo text: $foo."
> Alternatively, you might fiddle (carefully) with $IFS; e.g. `IFS=' will
> remove any special treatment of whitespace. Another solution would be
> to avoid shell conventions entirely and read thru an external program
> foo=`head -1`
I'll take a look at read. anf IFS.
Thanks for the help
More information about the OCLUG