Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Ex-bash script for optimisation
- X-seq: zsh-users 8575
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Ex-bash script for optimisation
- Date: Thu, 10 Mar 2005 16:43:10 +0000
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Sender: news <news@xxxxxxxxxxxxx>
Hi
Q1) Is there a better way to generate the array filelst
Q2) the line "for x in *$1*" fails is no match, how can i "catch" this
#!/bin/zsh
# v
# description : vi all files containing $1 in name
# but excluding non-text files
set +x
filebad=''
filelst=()
filenum='1'
for x in *$1*
do
if [[ "$x" == *.(aux|toc|dvi|aux|exe|obj|zip|pdf|mdb|xls|bak|swp|log|jpg|gif|tiff|jpeg|bmp) ]]
then
let filebad=1
else
if [ -f $x ]
then
filelst[$filenum]=$x
let filenum=filenum+1
fi
fi
done
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