On Fri, Aug 01, 2008 at 10:49:24PM -0600, Nicholas Blatter wrote: > I'm trying to write a shell script that makes use of wget to get some > data from the web. To help make things cleaner, I though I'd use a > variable to hold all the common options I was going to pass to wget, > including the user agent string. The problem is that bash appears to > be stripping the double quotes from the string before passing it to > wget. Here's some example code:
I've recently become a fan of arrays. Your example would look like:
ARGS=(--load-cookies "$COOKIES" --save-cookies "$COOKIES"
--keep-session-cookies --delete-after -U "$AGENT")
echo wget "[EMAIL PROTECTED]" http://www.google.com
Unlike some of the other solutions, this one is pretty unambiguous when
it comes to quotes and spaces. Unless I got something wrong, which is
always possible. :)
--
Andrew McNabb
http://www.mcnabbs.org/andrew/
PGP Fingerprint: 8A17 B57C 6879 1863 DE55 8012 AB4D 6098 8826 6868
pgpDLkzvhrgxj.pgp
Description: PGP signature
-------------------- BYU Unix Users Group http://uug.byu.edu/ The opinions expressed in this message are the responsibility of their author. They are not endorsed by BYU, the BYU CS Department or BYU-UUG. ___________________________________________________________________ List Info: http://uug.byu.edu/mailman/listinfo/uug-list
