creating variables

Matt Alexander plug-discuss@lists.plug.phoenix.az.us
Fri, 30 Aug 2002 11:23:31 -0700 (PDT)


VARIABLE=`ls /var/log/packages | grep mysql`

(note the use of backticks which run the command in a subshell and return
the result which is stored in $VARIABLE)
~M


On Fri, 30 Aug 2002, Nathan England wrote:

> I want to search a directory for a file name and throw it into a variable.
> Such as:
>
> /var/log/packages/mysql-3.23.51-i386-1
>
> I want to type in just mysql and have it create a variable for
> mysql-3.23.51-i386-1
>
> I was trying
> ls /var/log/packages | grep mysql
> but from there don't know how to get it into a variable
>
> And
> VARIABLE='ls /var/log/packages | grep mysql'
> doesn't work either.
>
> I have a script that searches for whatever I tell it.
>
> myscript something
>
> Something is a variable, but I type in a partial name, like mysql and it
> searches and prints the full name in the variable which would be $1 or $2 or
> $3 whatever...
>
> How do I accomplish this in bash?
>
> nathan
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> PLUG-discuss mailing list - PLUG-discuss@lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change  you mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>