Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6001011
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:46:32+00:00 2026-05-23T00:46:32+00:00

given the context below.. does any magic syntax exist that can be inserted in

  • 0

given the context below..

does any magic syntax exist that can be inserted in the definition of $WGETOPT to allow the $USERAGENT variable to be ‘absorbed’, and still allow for a call to the wget command as in syntax 1? i’ve currently resorted to using ‘eval’ which i’m not happy with, but maybe this is the only way i can do what i want to here?!

#params
USERAGENT="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
PROXYSWITCH=off
WGET=wget
WGETOPT="--cut-dirs=3 -r -l10 -dnv -x -H --timestamping --limit-rate=100K --proxy=$PROXYSWITCH -U \"$USERAGENT\"" 
WGETOPTminusUSERAGENT="-cut-dirs=3 -r -l10 -dnv -x -H --timestamping --limit-rate=100K --proxy=$PROXYSWITCH" 
URL=http://blah

#commands
#1.
    $WGET $WGETOPT $URL
#2.
    $WGET "$WGETOPT" $URL
#3.
    eval "$WGET $WGETOPT $URL"
#4. 
    $WGET $WGETOPTminusUSERAGENT -U "$USERAGENT" $URL

#1. results in:

DEBUG output created by Wget 1.11.4 on Windows-MinGW.
Enqueuing http://(compatible;/ at depth 0
Queue count 1, maxcount 1.
Host `(compatible;' has not issued a general basic challenge.
...
Setting --user-agent (useragent) to "Mozilla/4.0
...

it’s obvious why, the “\” didn’t ‘survive’ the bash interpreter.

#2. results in:

wget: --cut-dirs: Invalid number `3 -r -l10 -dnv -x -H --timesta.. ..indows NT 5.1)"'.'

here, the double-quotes result in a single argument being passed which wget parses a named parameter from, and then assumes (correctly) that the rest is its argument, regardless of white space.

#3. works, and i’m using it, but i do remember being chastised for using the evil/eval!

#4. i’ll assume works fine, i didn’t test it because that’s not how i want to do it!!

..hence the question.

cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:46:32+00:00Added an answer on May 23, 2026 at 12:46 am

    To amplify @Ignacio’s answer: if I understand the goal here, the best answer is to store the options in an array.

    #params
    USERAGENT="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"
    PROXYSWITCH=off
    WGET=wget
    WGETOPT=(--cut-dirs=3 -r -l10 -dnv -x -H --timestamping --limit-rate=100K --proxy=$PROXYSWITCH -U "$USERAGENT")
    
    $WGET "${WGETOPT[@]}" "$URL"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the schema below - with a query node as the context, is it
I want to be able to match against all elements in a given context
Today I saw a JavaScript syntax (when invoking a function) that is unfamiliar to
Below given is my layout which is I am using for displaying a table,
I have 3 files (file1.php, file2.php and file3.php). Their contents are given below. When
I didn't imagine that I would encounter radically new syntax in Java anymore at
Does anyone know if the iPad has any limitations on the canvas tag? Currently
The Python documentation for unittest implies that the assertRaises() method can be used as
I wish to display content depending on the given role(s) of the active user
Given this XML: <?xml version=1.0 encoding=utf-8?> <content dataType=XML> <item type=Promotion name=Sample Promotion expires=04/01/2009> <![CDATA[

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.