Skip to content

use command pwd instead of pwd #132

Merged
merged 1 commit into from May 28, 2014

2 participants

@lge88
lge88 commented May 15, 2014

No description provided.

@rupa
Owner
rupa commented May 16, 2014

I wasn't familiar with command - according the the docs:

          Run  command  with  args  suppressing  the normal shell function
          lookup. Only builtin commands or commands found in the PATH  are
          executed.

since it still looks in PATH, I feel like I'm missing something ... is it that it will always prefer a builtin to something in PATH?

I'm inclined to merge this, but explaining why this is helpful/neccessary to you would be nice for me :)

@lge88
lge88 commented May 16, 2014

This might be useful when user defined their own pwd alias/function. I defined an alias for pwd in my Mac:
alias pwd='command pwd | tee >(tr -d "\n" | pbcopy)'

Besides the buildin pwd functionality, it also pipe the current directory string to pbcopy (paste board copy), so that every time I type pwd in the terminal, the directory string gets copied into my paste board, I can then paste in other applications. Using `command pwd' just to make sure z use builtin pwd (/bin/pwd) instead of whatever available in the shell environment.

It shouldn't break anything, although I only test on my machine...

@rupa
Owner
rupa commented May 16, 2014

Ahh, makes sense - command pwd would certainly not use an alias.

It's a bash builtin, and looks to work in zsh too. I'll do another round of thinking about any possible drawbacks (i can't think of any) and merge this soon.

Thanks!

@lge88
lge88 commented May 16, 2014

Cool. Thanks for this great tool :)

@rupa rupa merged commit 24895f3 into rupa:master May 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.