[kwlug-disc] wget and variable assignment
richard at weait.com
Thu Jun 3 13:57:20 EDT 2010
On Thu, Jun 3, 2010 at 1:48 PM, Tim Utschig <tim at tetro.net> wrote:
> The newlines are kept, you just need to be sure to quote it:
> $ OUTPUT=`wget -q -O - http://google.com/`
> $ echo $OUTPUT | wc -l
> $ echo "$OUTPUT" | wc -l
> The first is unquoted, and as a result gets split at whitespace
> into separate arguments. The second gets passed a single
> argument, since it's quoted. Below shows the argument count:
> $ sh -c 'echo $#' - $OUTPUT
> $ sh -c 'echo $#' - "$OUTPUT"
Excellent. Thank you!
More information about the kwlug-disc_kwlug.org