3 ms·
I personally have a single function that takes care of all of those dotted aliases: function up { local ups="." for((i=0;i<${1:-1};i++)); d
by msoucy 9y ago
I personally have a single function that takes care of all of those dotted aliases:
function up {
local ups="."
for((i=0;i<${1:-1};i++)); do
ups="${ups}/.."
done
cd "$ups"
}
- kbd 9y agoI appreciate the DRY-ness of it, but that requires you to type 'up ...' which is longer :( A while ago when I was bored I was thinking of golfing those aliases to say (pseudocode): for i in 2..6: alias '.'*i=cd '../'*i but I didn't know all the shell needed and just wound up leaving it as is. Edit: turns out Zsh has a 'repeat' built-in: alias $(repeat 7 echo -n '.')="cd $(repeat 7 echo -n '../')" Still, non-portable, less clear, not worth changing the aliases.