Picking out the right file when ls | greping
I'm writing a script where I have to use ls | grep and search for a file in the current directory. I am assigning the name of this file to a variable so it needs to be precise. My only problem is that the file that I am grepping for has a brother which happens to have a different extension. I want to pick out the right file and send it to the variable.
Heres an example just to clarify:
I am in /home/m/temp
in the script I say:
a=`ls | grep myFile`
the value now stored in a is: myFile.exe myfFile.dll
I only want to store myFile.exe
How would I do this? Thanks.
|