shell variable to include wildcard character

shell variable to include wildcard character

Post by pipe » Sat, 27 Feb 1999 04:00:00



I'm having a problem getting a shell variable to include a wild card
character, without the unix environment expanding the variable.  Basically I
would like the variable to reflect the string "filename.*"  However,
although I am aware that you can preceed the * by another character which
will stop the unix environment from interpretting it, I'm at a loss as to
what that particular character is.
 
 
 

shell variable to include wildcard character

Post by RocketMa » Sat, 27 Feb 1999 04:00:00


Hi,
Are U thinking of "\"

rgds
Jaya


>I'm having a problem getting a shell variable to include a wild card
>character, without the unix environment expanding the variable.  Basically
I
>would like the variable to reflect the string "filename.*"  However,
>although I am aware that you can preceed the * by another character which
>will stop the unix environment from interpretting it, I'm at a loss as to
>what that particular character is.


 
 
 

shell variable to include wildcard character

Post by Ted J. Loeffelhol » Sat, 27 Feb 1999 04:00:00



> I'm having a problem getting a shell variable to include a wild card
> character, without the unix environment expanding the variable.  Basically I
> would like the variable to reflect the string "filename.*"  However,
> although I am aware that you can preceed the * by another character which
> will stop the unix environment from interpretting it, I'm at a loss as to
> what that particular character is.

For sh the command would be:

$ x='filename.*'
$ echo $x
filename.*

-or-

$ x=filename.\*
$ echo $x
filename.*

for csh:

41: set x='filename.*'
42: echo "$x"
filename.*

....I think you get the picture.

A word of caution ... make sure you know how the shell is going to
evaluate this before you do anything "permanent" with it.

Hope it helps,
Ted

 
 
 

shell variable to include wildcard character

Post by pipe » Sat, 27 Feb 1999 04:00:00


No sorry, I've tried every conceivable "/" there is!

>Hi,
>Are U thinking of "\"

>rgds
>Jaya

>>I'm having a problem getting a shell variable to include a wild card
>>character, without the unix environment expanding the variable.  Basically
>I
>>would like the variable to reflect the string "filename.*"  However,
>>although I am aware that you can preceed the * by another character which
>>will stop the unix environment from interpretting it, I'm at a loss as to
>>what that particular character is.

 
 
 

shell variable to include wildcard character

Post by Eric Amic » Sat, 06 Mar 1999 04:00:00




>> I'm having a problem getting a shell variable to include a wild card
>> character, without the unix environment expanding the variable.  Basically I
>> would like the variable to reflect the string "filename.*"  However,
>> although I am aware that you can preceed the * by another character which
>> will stop the unix environment from interpretting it, I'm at a loss as to
>> what that particular character is.
> For sh the command would be:
> $ x='filename.*'
> $ echo $x
> filename.*
> -or-
> $ x=filename.\*
> $ echo $x
> filename.*

Double quotes will work just as well, for that matter, in all shells.

--
Eric Amick
Columbia, MD

 
 
 

1. Using the * wildcard in a shell script path variable

I'm trying to set up a shell path variable using the * wildcard so I
don't have to explicitly identify each subdirectory in a path.
Unfortuately, it's not working.  Here's the detail:

I have the following directory structure:

/applic/oraweb/dir_one/web_forms
/applic/oraweb/dir_two/web_forms
/applic/oraweb/dir_three/web_forms
/applic/oraweb/dir_four/web_forms

In a shell script I am setting a variable named FORMS60_PATH as listed
below.  When I use a wildcard * in the /applic/oraweb/*/web_forms
section, it resolves it literally when the shell is executed.

FORMS60_PATH=$ORACLE_HOME/forms60:/$ORACLE_HOME/tools/forms:/applic/oraweb/*/web_forms:"$FORMS60_PATH;
export FORMS60_PATH

When I replace the * wildcard with the actual values, (see below),
everything works fine.  Question is:  Is there a way to use a wildcard
in this context so I don't have to keep modifying my shell script each
time a new directory is added?  

FORMS60_PATH=$ORACLE_HOME/forms60:/$ORACLE_HOME/tools/forms:/applic/oraweb/dir_one/web_forms:/applic/oraweb/dir_two/web_forms:/applic/oraweb/dir_three/web_forms:/applic/oraweb/dir_four/web_forms:"$FORMS60_PATH;
export FORMS60_PATH

Thanks!

Carl DiPasquale
Oracle DBA
Visteon Corporation

2. intergraph intense-board

3. Expanding a shell variable that may contain shell variables.

4. Compiling Issue on Sun

5. IFS shell variable & /usr/include/sysexits.h EXITCODE 75

6. Help! Cannot print from RH6 to Win98 printer

7. tcsh 6.03 isn't expanding wildcard characters on HP-UX 9.01

8. PCMCIA on IBM Think Pad

9. Wildcard characters and rc

10. Wildcard characters in Apache 1.1.1 scriptalias?

11. Passing Quoted Wildcard Characters to a C Program

12. sed and wildcard meta characters