Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: simplify and if then else
- X-seq: zsh-users 13285
- From: "Mikael Magnusson" <mikachu@xxxxxxxxx>
- To: "Peter Stephenson" <pws@xxxxxxx>
- Subject: Re: simplify and if then else
- Date: Wed, 24 Sep 2008 13:53:13 +0200
- Cc: zzapper <david@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=jnU+NG+yz5yW0uH2pkOT8ghLNYYjxkXz/pYqpWwyEo0=; b=dstBwoEGjfV1Z9A5Uu135n+L9ZJBf2fbgjgLzYuhltUwHmnnZEYZOkTKRm3Zx9zZqY Do27bns1wxHtDsR2e0B32ZpRQrqZsgMDeFdBYkIOpEr1XuWJBoIQq0PHcmDUCqi1NJkr 3Hd+3G1TuLMnSV45ZvflfiCQkkpZN/lp5KSrU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=hsb8xljwVbrt1KyF4s0T172zDnKeEVMUdhn3zjJJXmu34gMVR+9NN+dJmBdCNGGCkF i8UgGxHLUDZQWHbf9MQq2H9lH2FXFyjOI+fIT/ETvdSoG8qRHFvbZy8nZLUp0yzOKzNr be4xlLSjh6Q4Me7/BxQlgBNCvZ1rUWmrisNSY=
- In-reply-to: <200809241144.m8OBiQhd017368@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9B237D944CFB3zzappergmailcom@xxxxxxxxxxxx> <200809241144.m8OBiQhd017368@xxxxxxxxxxxxxx>
2008/9/24 Peter Stephenson <pws@xxxxxxx>:
> zzapper wrote:
>> Hi
>> Having a Homer Simpson moment, but this must be easy to simplify
>> if [[ "$LOGNAME" != davidr ]]
>> then
>> cd /o/inetpub/wwwdev/www.some.co.uk/epsystem/epadmin
>> else
>> cd /c/inetpub/wwwdev/www.some.co.uk/epsystem/epadmin
>> fi
>>
> cd \
> ${${${LOGNAME:#davidr}:+/o}:-/c}/inetpub/wwwdev/www.some.co.uk/epsystem/epadmin
>
> although if LOGNAME is empty it's treated the same as if it were davidr;
> if that's an issue it gets even more clumsy:
>
> ${${${${LOGNAME:-x}:#davidr}:+/o}:-/c}
A bit longer but arguably still simpler :)
cd /$([[ "$LOGNAME" != davidr ]] && echo o || echo c)/inetpub/wwdev/blabla
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author