Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Can an alias ever have a dynamic element?



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