On Friday 01 August 2008, 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: > > #!/bin/bash > > AGENT="Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) > Gecko/20080702 Firefox/2.0.0.16" > COOKIES="cookies.txt" > ARGS="--load-cookies $COOKIES --save-cookies $COOKIES > --keep-session-cookies --delete-after -U \"$AGENT\"" > > echo wget $ARGS http://www.google.com > > echo ----- > > wget $ARGS http://www.google.com
Do: wget $(eval $ARGS) http://www.google.com -------------------- 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
