passing globbing expressions as argument to bash script
I wish to shorten the 'find' command and have written my own script: ff
ff after echoing some information issues find $1 -iname $2 where I issue the command in a terminal: ff . '*.mm' (find all of the files that have an 'mm' extension in the current directory and below) find . -iname '*.mm' and find . -iname \*\.mm both work I have tried various combinations of ' and " and \ and \\ to get this command to work Any explanation of why this is not working would be greatly appreciated. Thanks in advance |
Quote:
|
You are implying that your script does not work .... in what way? Are you getting errors?
|
Thanks for the link to the beginners guide. Did not find the answer I was looking for probably because my question was poorly formed.
1) when I say the script didn't work, it was because it did not find the files though they exist. 2)To hopefully clarify my question, here's what I want to do: I want to issue a command like ff . '*.mm' ff is a script I wrote. It has has one command in it: find $1 -iname $2 No amount of playing with the 2md argument of the ff command will get the result that I want, which is to list all of files in the "." directory (current directory) with the "mm" extension. The script runs (I put out some echo statements in it) but it does not list the files. Again, thanks in advance. |
Did you try putting the second argument in quotes?
And for that matter to be on the safe side in case the first has unusual characters in it i would put that in quotes too. |
Quote:
ff . \*\.mm ff . "*.mm" ff . '"*.mm"' ff . "'*.mm'" and have tried numerous versions of quote with the escape \ eg. ff . "\*\*.mm" ff . "*\.mm" ff . '\*\.mm' ff . '*.\mm' and versions with " and ' with the escape |
Quote:
When I issue the script: ff . \*\.mm and the script issues find "$1" -iname "$2" I get the listing I was looking for. Thanks for the help |
All times are GMT -5. The time now is 06:10 AM. |