Hacker News new | past | comments | ask | show | jobs | submit login

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.



There'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; }


Thanks for pointing out that




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: