[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Avoiding pattern expansion in bash?



On Sunday October 10 2004 05:11, Olle Eriksson wrote:
> 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.

This is handled in the Unix Hater's Handbook (search for in on Google, it's 
avaliable as PDF and quite funny).

The expression ${1+"$@"} expands to almost the original commandline (with 
compressed whitespace). It doesn't prevent the shell from doing parameter 
expansion in the first place, but it allows you to access the originals 
anyway.

-- 
Some people have parts that are so private they themselves have no
knowledge of them.

Attachment: pgpbD8IO7848W.pgp
Description: PGP signature


Reply to: