3 ms·
I use `..` to go upper directory, `...` to go up two levels, I added this to bashrc: str='..' level='./../' for i in `seq 1 10`; do eval "alias '
by dongsheng 15y ago
I use `..` to go upper directory, `...` to go up two levels, I added this to bashrc:
str='..'
level='./../'
for i in `seq 1 10`;
do
eval "alias '$str=cd $level'"
level=$level'../'
str=$str'.'
done
Note, seq is not available in Mac, should use jot instead.
- imurray 15y agoThere's no need for seq or jot. In bash you can replace `seq 1 10` with {1..10}. Or {01..10} if you want zero padding when using $i to label files. I use an function called "up" that takes an optional integer argument to go up a certain number of levels. It won't necessarily be faster, but somehow I prefer it to typing lots of dots in a row: function up () { if test $# = 1 ; then s=$( printf "%$1s" ); s=${s// /..\/}; cd $s ; else cd .. ; fi; }
- dongsheng 15y agoThanks for pointing out that