Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Can an alias ever have a dynamic element?
- X-seq: zsh-users 18244
- From: zzapper <david@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Can an alias ever have a dynamic element?
- Date: Tue, 17 Dec 2013 18:41:17 +0000 (UTC)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: rayninfo
- References: <XnsA2999C087BB98davidrayninfocouk@80.91.229.13> <131217091556.ZM8432@torch.brasslantern.com>
Bart Schaefer > }
> } I have an alias which creates a tar with a date component in its name
> } that date is however evaluated when the shell is created which could
> } have been a few days ago. The easy solution is to create a script but
> } is they any alternative?
>
> This usually means you've created the alias with something like:
>
> alias thingy="foo $(date)"
>
> when what you need are single rather than double quotes:
>
> alias thingy='foo $(date)'
>
>
LOL I foolishly never realised that single and double quotes behaved
differently for aliases!!
alias maketar='dw && zargs ./**/*.{php,inc,js} -- tar rvf /tmp/serviceplan
$(date "+%d-%m-%Y").tar
Thanks Bart
https://twitter.com/dailyzshtip
Messages sorted by:
Reverse Date,
Date,
Thread,
Author