Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: simplify and if then else
- X-seq: zsh-users 13284
- From: Peter Stephenson <pws@xxxxxxx>
- To: zzapper <david@xxxxxxxxxx>
- Subject: Re: simplify and if then else
- Date: Wed, 24 Sep 2008 12:44:26 +0100
- Cc: zsh-users@xxxxxxxxxx
- In-reply-to: <Xns9B237D944CFB3zzappergmailcom@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9B237D944CFB3zzappergmailcom@xxxxxxxxxxxx>
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
>
> --
> zzapper
> http://www.successtheory.com/tips/vimtips.html
>
>
>
>
> To report this email as spam click https://www.mailcontrol.com/sr/B4ikS7CuQx
> HTndxI!oX7UpIgRUnoDh5vM4IlkUtlbP1h3mjxHrJheu1GxnkVntZMuoKbcOI0SxgpdY6WjzZSeg=
> = .
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}
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Messages sorted by:
Reverse Date,
Date,
Thread,
Author