cd on exit, subshell stuff

This commit is contained in:
Dylan Araps committed 2020-08-06 13:28:39 +03:00
1 parent 73075390e7
commit e2f2aa9caf
2 files changed
+32 -6

No files matched your search

+25
View File
@@ -15,6 +15,8 @@ ________________________________________________________________________________
* no compilation needed
* correctly handles files with funky names (newlines, etc)
* works with very small terminal sizes.
* cd on exit
* works when run in subshell $(shfm)
*** see portability notes towards bottom of README.
@@ -50,6 +52,29 @@ ________________________________________________________________________________
- [x] look into whether tput is feasible.
cd on exit
________________________________________________________________________________
On exit, the utility will print the path to working directory to <stdout>. To
disable this behavior, run with 'shfm >/dev/null'. Usage of this output is
rather flexible.
# cd to directory on exit
cd "$(shfm)"
# store pwd in var on exit
var=$(shfm)
# store pwd in a file one exit
shfm > file
For ease of use, a wrapper function can be added to your .shellrc (.bashrc, etc).
shfm() {
cd "$(command shfm)"
}
opener
________________________________________________________________________________