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

Re: option to show file:line everytime echo is called?



actually this doesn't work:

path/.zshrc:
```
alias echo2='echo ${0:A}:$LINENO'
echo2 FOO
fun(){
  echo2 BAR
}
fun
```

shows:
path/.zshrc:2 FOO #OK
$PWD/fun:1 BAR #NOT OK, I want path/.zshrc:4

On Tue, Jan 10, 2017 at 10:17 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
wrote:

> Ray Andrews wrote on Tue, Jan 10, 2017 at 09:12:37 -0800:
> > On 10/01/17 04:30 AM, Anthony Heading wrote:
> > >
> > >Maybe use an alias?
> > >
> > >#!/bin/env zsh
> > >alias echo='echo ${0:A}:$LINENO'
> > Where can I read up on " ${0:A} ", I haven't seen that construction
> before.
> > And probably there's a host of siblings equally useful.
>
> That's the `:A' modifier applied to the `$0' variable.
>
> :A is in http://zsh.sourceforge.net/Doc/Release/Expansion.html#Modifiers
>
> $0 is in http://zsh.sourceforge.net/Doc/Release/Parameters.html#
> Parameters-Set-By-The-Shell
>


Messages sorted by: Reverse Date, Date, Thread, Author