-   Linux - Newbie (
-   -   script execute command problem (

ninja master 07-24-2011 08:38 PM

script execute command problem
i would like to create a script that calls a command with a flag....



"curl -O"

-------------------------------answering my own post-----------------------------------
sudo su

cat > /usr/bin/wget << EOF
curl -O $1
chmod 750 /usr/bin/wget

the real question is this script properly written, and if not how would a more proper writing of this script look

grail 07-24-2011 10:37 PM

I would have said the real question is why would you try to recreate wget when it already exists and may already be on your system so this may actually cause a conflict.

As to whether or not it will work ... the old adage of suck it and see looks good for such a short non-impacting script.

ninja master 02-21-2012 07:05 PM

curl supports moar protocol than wget......

uhelp 02-21-2012 07:26 PM

The use of "<<EOF" is pointless.
Unless one want to type more than needed.
The single "cat > DoNotNameAnyScriptLikeAnExistingCommand" does the trick. (If finished give it the EOF with ^d meaning <ctrl><d> )



outFile="-O $1"  #prepares the option -O
shift            # shifts away the URL

curl "$*" "$outFile"

with this script you can use it like intended "NOTwget URL" or use all the other options curl takes as well.

All times are GMT -5. The time now is 12:55 PM.