Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Ex-bash script for optimisation



On Fri, 11 Mar 2005 04:48:46 +0000,  wrote:


>
>#--- snip ---
>setopt local_options extended_glob null_glob
>filelst=( *$1*~*.(aux|toc|dvi|aux|exe|obj|zip|pdf|mdb|xls|bak|swp|log|jpg|gif|tiff|jpeg|bmp) )
>#--- snip ---
>
>If you want to allow $1 to be a pattern rather than a fixed string, you
>need *${~1}* instead.
>
>If you want to allow multiple arguments to the script, you need *${^*}*
>or for multiple patterns *${^~*}*
>
Bart
Only the first example worked for me, but I found $1 could be a pattern, and i could set a second
parameter w/o problem

setopt local_options extended_glob null_glob
filelst=( *$1*~*.(aux|toc|dvi|aux|exe|obj|zip|pdf|mdb|xls|bak|swp|log|jpg|gif|tiff|jpeg|bmp) )

if (( ${#filelst} ))
then
echo "file list : " $filelst
gvim.exe ${filelst[*]} &
else
echo "Sorry no file matched *$1*"
fi



Messages sorted by: Reverse Date, Date, Thread, Author