I'm a complete newbie to bash scripting.
I remember there was a way to execute the cd
command, automatically returning to the previous directory (without an explicit cd ...
).
Any idea?
相关问题
- How to access the camera from my Windows Phone 8 a
- JQ: Select when attribute value exists in a bash a
- bash print whole line after splitting line with if
- “command not found” errors in expect script execut
- grep using grep results
相关文章
- Check if directory exists on remote machine with s
- Is there a non-java, cross platform way to launch
- Reverse four length of letters with sed in unix
- Launch interactive SSH bash session from PHP
- BASH: Basic if then and variable assignment
- Bash script that creates a directory structure
- Test if File/Dir exists over SSH/Sudo in Python/Ba
- How can I create a “tmp” directory with Elastic Be
Also, pushd and popd can come in very handy - they represent operations on a stack of directory locations - allowing you to "travel back in time".
You can also try the
cdargs
package. You can find a tutorial here: http://www.csrdu.org/nauman/2011/01/16/helpful-tips-for-newbie-system-admins/Summary:
Mark a directory and move around:
See the link for other commands or search the net.
Found! I can execute it as a sub-shell.
SOURCE: http://tldp.org/LDP/abs/html/subshells.html
If you just want to go back to the last directory, you can use
cd -
.If you need more places to go back to, try
pushd <dir>
(instead ofcd <dir>
) and then you can go back withpopd
.