----- Original Message -----
From: "David C. Rankin"
Bash wizards:
I have run across another quandary. I am trying to get a filespec from the command line like:
./scriptname file1*
You need to say ./scriptname 'file1*'
and file name expansion occurs before I can assign the filespec to a variable. I want to be able to grab the 'file1*' filespec without having to require that it be enclosed in single quotes (./scriptname 'file1*'). I'm using the filespec
Sorry, not an option. The only way you can get the litteral string "file1*" passed is to prevent the interactive shell from expanding it before-hand. The only ways to do this are: ./scriptname 'file1*' or ./scriptname file1\* or set -f ./scriptname file1* This shouldn't be viewed as a limitation or hardship, but rather as an ability or a feature. The ability to be precise. Globbing is a very powerful and useful feature, and so it's active by default. But sometimes in some rare and special cases you don't want the globbing to occure, and so another feature is the ability to suspend the globbing from happening, and since no single way of doing something is always convenient, there is even at least the 3 different methods above to suspend the globbing. In other words, I think it's a mistake to even try or want to avoid saying program 'litteral' That is the way the entire system works and as a unix shell user it should just be a natural part of the interface for you. You still need to use the same quoting and escaping syntax with every other program anyways, which means you still need know the times & places when globbing will happen and the times & places when you don't want it to happen. If you are trying to make a program that other users will use who are not necessarily unix users and you don't want them to require them to be this savvy, you could make the script interactive. Then they would type in the filespec into a read command, and you can put a set -f in the script before the read, then they wouldn't have to do any special quoting. Or you could make a seperate xterm/gnome-terminal/etc desktop icon that launches bash with -f so globbing is disabled for that window. -- Brian K. White brian@aljex.com http://www.myspace.com/KEYofR +++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++. filePro BBx Linux SCO FreeBSD #callahans Satriani Filk! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org