Linux Today: Linux News On Internet Time.

More on LinuxToday

Bash: Preserving Whitespace Using set and eval

Nov 06, 2008, 12:05 (0 Talkback[s])
(Other stories by Mitch Frazier)

"The set command takes any arguments after the options (here "--" signals the end of the options) and assigns them to the positional parameters ($0..$n). The eval command executes its arguments as a bash command.

"If you do this without the eval command you'll get the same result as the first example. By passing the set command to eval bash will honor the embedded quotes in the string rather than assume they are part of the word."

Complete Story

Related Stories: