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 If you run the example, the first echo prints exactly what I want wget to run and if you copy/paste this it will work fine. The problem is when wget actually gets called. From wget's output you can see that the quotes have been stripped and it's trying to download all the space-delimited strings in the user agent. I've tried several things to fix this but nothing has worked. I imagine it's some kind of bash string manipulation that I'm not aware of. In any case, I'd appreciate any help or pointers (aside from "just do it in perl" ;). Thanks, Nick -------------------- 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
