Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Manually feeding variable into a bash script

Name: Anonymous 2011-05-30 17:01

I have a script which cleans files from certain directories, and it contains "$1" variable (which is the directory to run the script in) which sabnzbd feeds into the script when its run.

Now i want to sometimes run the script manually and specify the directory. Is there a command line option where i can specify 1.
so something like

echo 1=/dir/to/clean | ./locationofscript

Name: Anonymous 2011-05-30 17:05

...
I hope this isn't a trick question.
./locationofscript /dir/to/clean

Name: Anonymous 2011-05-30 17:05

uhmm....
well...
there is a way...
but don't tell anyone i told you
just invoke your script in this special secret way: ./locationofscript /dir/to/clean

Name: Autistic Duck 2011-05-31 2:45

Manually grab a fresh long variable, trim and peel it, hovering just above the salivating bash script. Let it take a bite, then watch as it clumsily tries to reach the rest, but crashes on the stack.

Don't change these.
Name: Email:
Entire Thread Thread List