4 ms·
It's useful to be able to write functions for your shell. For example, I have a function up, which moves up n dirs.
by uxcn 11y ago
It's useful to be able to write functions for your shell. For example, I have a function up, which moves up n dirs.
- cglace 11y agoI wrote this function for my .bashrc as soon as I read this.
- uxcn 11y agoI use pup a lot too, which just prints the dir.
- tux1968 11y agoZsh has quite a nice option "auto_cd". If the first word you type doesn't resolve to a command, it tries to change the current working directory to it instead. So just typing ~ will get you to $HOME, and .. will take you up one.
- lisivka 11y agoalias '..=cd ..' alias '~=cd "$HOME"'
- tux1968 11y agoYes. Although you get it for free with Zsh where it works with any directory you type. Not just the ones you think to make an alias for beforehand. :-)
- SomeCallMeTim 11y agoAt one point I had ".." aliased to one directory up, "..." to two, and so forth. For navigating I found that preferable to cd ../../.. etc.
- samf 11y agoI love this option. I type "/tmp" when I'm about to create some short-lived scratch files. Those saying "you can just alias that" are missing the point. Where do you stop with the aliases?
- wcummings 11y ago(defun eshell/up (n) (dotimes (i n) (cd "..")))
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]