25

I am having a problem I'm not sure how to get around.

Somehwhere on my system, I have an alias defined as such:

alias subl=\''/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl'\'

I am not sure what file this is in, and I want to change (or actually remove) it.

I could just unalias it in my .zshrc, but that's not as elegant a solution.

When I run alias | grep subl it shows me the alias. Is there a way for me to have it also echo the path to the file defining the alias?

Thanks

2
  • 1
    I think that if there is something inelegant here it is probably that you have so many shell configuration files that you do not know where they are. No offense or anything, but.... maybe do without that oh your zsh - that' a behemoth man.
    – mikeserv
    Commented Dec 28, 2014 at 1:34
  • 1
    anyway, maybe try grep -R 'alias subl...'
    – mikeserv
    Commented Dec 28, 2014 at 1:37

1 Answer 1

30
zsh -x 2>zsh.trace
exit
grep 'alias.*subl' zsh.trace

The -x option causes zsh to print out every command that it executes on stderr. Any command that was executed from reading a file has a prefix with the file name and line. So look for the alias definition in the trace file and you'll know where it was defined.

1
  • Clever. But even if it helps him here, there probably isn't a big enough bandaid for the source of this problem.' Though, in honesty, reading through the file that produces might be something of a wakeup call, too.
    – mikeserv
    Commented Dec 28, 2014 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .