Mailinglist Archive: opensuse (2740 mails)

< Previous Next >
Re: [opensuse] bash - handling expansion of parameters on the command line?
  • From: Anders Johansson <ajohansson@xxxxxxx>
  • Date: Tue, 2 Dec 2008 22:16:01 +0100
  • Message-id: <200812022216.02528.ajohansson@xxxxxxx>
On Tuesday 02 December 2008 03:25:44 David C. Rankin wrote:
Bash wizards:

I have run across another quandary. I am trying to get a filespec from
the
command line like:

./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*').

Others have replied with how you should be doing it, so I'll just add how you
can disable globbing (the term for matching wild cards with file names)

set -f

or

set -o noglob on

This will disable all globbing, so file1* will be sent as is to your program.

You can turn it back on with either

set +f

or

set -o noglob off

Anders
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
References