|
Prev: Boot up
Next: Obama supporters have apparently infiltrated Google groups andblocked ISP's sending Obama negatives
From: wylbur37 on 20 Apr 2008 20:28 If the current directory that I'm sitting on has the files "one.txt", "two.txt" and "three.txt", and I run a script called "xyz" by saying ... xyz *.txt it'll be the same as if I had said ... xyz one.txt two.txt three.txt From within the script, "$0" will return the name of the script itself, "$1" will return "one.txt", and "$*" will return "one.txt two.txt three.txt". But what I need is the original un-expanded argument(s). In other words, what I need is the "*.txt" (without the quotes). How can I get that?
From: Bit Twister on 20 Apr 2008 20:57 On Sun, 20 Apr 2008 17:28:37 -0700 (PDT), wylbur37 wrote: > If the current directory that I'm sitting on has the files "one.txt", > "two.txt" and "three.txt", > and I run a script called "xyz" by saying ... > > xyz *.txt > > But what I need is the original un-expanded argument(s). > In other words, what I need is the "*.txt" (without the quotes). xyz '*.txt'
From: Unruh on 21 Apr 2008 02:19 wylbur37 <wylbur37nospam(a)yahoo.com> writes: >If the current directory that I'm sitting on has the files "one.txt", >"two.txt" and "three.txt", >and I run a script called "xyz" by saying ... > xyz *.txt >it'll be the same as if I had said ... > xyz one.txt two.txt three.txt >From within the script, "$0" will return the name of the script >itself, >"$1" will return "one.txt", and "$*" will return "one.txt two.txt >three.txt". >But what I need is the original un-expanded argument(s). >In other words, what I need is the "*.txt" (without the quotes). You cannot. The program never gets that. the shell expands teh arguments long before the program ever sees the argument. If you want the program to get the unexpanded argument you need to feed it to the program in single quotes. And then it is up to the program to expand teh arguments. >How can I get that?
From: pk on 21 Apr 2008 04:48 On Monday 21 April 2008 02:28, wylbur37 wrote: > If the current directory that I'm sitting on has the files "one.txt", > "two.txt" and "three.txt", > and I run a script called "xyz" by saying ... > > xyz *.txt > > it'll be the same as if I had said ... > > xyz one.txt two.txt three.txt > > From within the script, "$0" will return the name of the script > itself, > "$1" will return "one.txt", and "$*" will return "one.txt two.txt > three.txt". > > But what I need is the original un-expanded argument(s). > In other words, what I need is the "*.txt" (without the quotes). > > How can I get that? set -f; xyz *.txt; set +f
From: Robert Newson on 21 Apr 2008 16:15
wylbur37 wrote: > If the current directory that I'm sitting on has the files "one.txt", > "two.txt" and "three.txt", > and I run a script called "xyz" by saying ... > > xyz *.txt > > it'll be the same as if I had said ... > > xyz one.txt two.txt three.txt > > From within the script, "$0" will return the name of the script > itself, > "$1" will return "one.txt", and "$*" will return "one.txt two.txt > three.txt". > > But what I need is the original un-expanded argument(s). > In other words, what I need is the "*.txt" (without the quotes). > > How can I get that? xyz \*.txt |