Skip to content

Instantly share code, notes, and snippets.

@janmoesen
Last active Dec 20, 2015
Embed
What would you like to do?
Not sure if I can ever forgive myself for this, but here goes: "automatically" creating "useful" aliases for "cd ../../../" etc. See https://twitter.com/padolsey/status/364416098474541056
stack=('');
for i in {1..10}; do
printf -v alias_name '.%s' "${stack[@]}";
printf -v path '../%s' "${stack[@]}";
alias ".$alias_name"="cd $path";
stack+=('');
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment