Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Script breaking on cd *param
- X-seq: zsh-users 11059
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Script breaking on cd *param
- Date: Wed, 6 Dec 2006 12:11:41 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- Sender: news <news@xxxxxxxxxxxxx>
Hi
The following should try to cd to a subdirectory in the 4 following ways.
cd param
cd param*
cd *param
cd *param*
However if it fails on the second the script breaks
with "no matches found: *param "
sometimes putting quotes round ${1}* seems to help
alias if_param='
if [ $# -gt 0 ]
then
if builtin cd $1 &> /dev/null ;
then
shift
elif builtin cd ${1}* &> /dev/null;
then
shift
elif builtin cd *$1 &> /dev/null;
then
shift
elif builtin cd *${1}* &> /dev/null;
then
shift
else
echo $1 not found
shift
fi
fi
'
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author