On Sunday 10 October 2004 05.24, Travis Crump wrote: > Olle Eriksson wrote: > > This might be a little off topic but here it goes anyway. > > > > I am writing a bash script that takes as input a file expression such > > as "/etc/lilo.conf" or "/boot/config*" etc. I want to keep those > > strings as they are (including the *) and echo them to a file. How do > > I prevent bash from doing its pattern expansion where it turns > > /boot/config* into a list of files that match the expression. > > > > If I use echo "$1" it becomes the first file that matches the > > expression /boot/config*. If I use echo "$*" it becomes a space > > separated list of all the files that match the expression. I want > > none of this. > > > > Any ideas? > > > > Regards > > Olle Eriksson > > [EMAIL PROTECTED]:/tmp$ cat test.sh > #!/bin/sh > > echo "$1" > [EMAIL PROTECTED]:/tmp$ ./test.sh '/boot/config*' > /boot/config* > > Not sure I understand what exactly is the problem you are having...
Ah.. I was missing the '' around the expression when calling the script. I was experimenting with all sorts of things inside the script file and forgot about that. Ok now I can get this to work. Thanks. Just out of curiousity, is it possible to prevent the parameter from being expanded without those '' on the command line? Regards Olle Eriksson -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]