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 '?
I don't quite understand what you are asking here.
Maybe you could try something like this?
echo cd `pwd` > /tmp/file
In case you're trying to accomplish this:
cd - # Changes directory to the last one you were in
pushd and popd # Push current directories on a stack with pushd # Pop them back out (change to them) with popd