Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As I understand it, ~+ means the same thing as "the current working directory".

So echo ~+ should print the same as pwd.

What is the purpose of this tilde expansion ~+ ?

share|improve this question
3  
It's not as portable compared to $PWD. –  jw013 May 2 '12 at 21:17
    
~- works as well... –  polemon May 2 '12 at 22:21
    
@polemon, ~- only works if you haven't already run pushd. It means the last directory in the stack, not the first. –  Mikel May 2 '12 at 22:39
    
Hmm, ok. Didn't even know that. –  polemon May 2 '12 at 23:14
add comment

1 Answer

up vote 3 down vote accepted

It's there for completeness.

You could use it as a shorter form of $PWD. You save a whole two keystrokes!

share|improve this answer
    
I save three with my keyboard layout :) –  Marco May 3 '12 at 0:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.