Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Script breaking on cd *param
- X-seq: zsh-users 11061
- From: zzapper <david@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Script breaking on cd *param
- Date: Wed, 6 Dec 2006 13:42:48 +0000 (UTC)
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Organization: SuccessTheory
- References: <Xns98917C0D1AAA8zzappergmailcom@xxxxxxxxxxx> <200612061226.kB6CQnpu022275@xxxxxxxxxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
Peter Stephenson <pws@xxxxxxx> wrote in news:200612061226.kB6CQnpu022275
@news01.csr.com:
> local str
> local -a dirs
> for str in param param\* \*param \*param\*; do
> # Expands to all matching directories, else nothing.
> dirs=(${~str}(N/))
> if (( ${#dirs} == 1 )); then
> cd $dirs
> break
> fi
> done
PWS
Thanx JWTDO
but did you forget the dollars on $param?
function cdc()
{
local str
local param=$1
local -a dirs
echo $param
for str in $param $param\* \*$param \*$param\*; do
# Expands to all matching directories, else nothing.
dirs=(${~str}(N/))
if (( ${#dirs} == 1 )); then
cd $dirs
break
fi
done
}
--
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips
Messages sorted by:
Reverse Date,
Date,
Thread,
Author