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 in, say I execute pwd to return the current directory and want to dump this in a script file so that I can come back, but I then need to prefix it with 'cd '?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

I don't quite understand what you are asking here.

Maybe you could try something like this?

echo cd `pwd` > /tmp/file
share|improve this answer
    
I was messing around with awk & pipes. Doh. Thanks so much! –  M. Tibbits Aug 20 '11 at 2:02
add comment

In case you're trying to accomplish this:

cd -
# Changes directory to the last one you were in

or

pushd and popd
# Push current directories on a stack with pushd
# Pop them back out (change to them) with popd
share|improve this answer
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.