creating variables

Nathan England plug-discuss@lists.plug.phoenix.az.us
Fri, 30 Aug 2002 09:18:39 -0700


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