Posted By

zingo on 06/17/07


Tagged

Bash


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

leachypeachy


cd's to a directory and lists the contents


 / Published in: Bash
 

URL: http://cutup.org/anize/?bash_tricks

for .bashrc, a function that cd's to a directory and lists the contents it takes ls arguments and a directory. for example, cl goes to home dir and lists contents. cl -l goes to ~/ and long lists contents. and cl -lrt publichtml shows the contents of publichtml in long list reverse time order.

  1. function cl () {
  2. case $1 in
  3. -*) local o=$1; shift;;
  4. esac
  5. cd $* && ls $o
  6. }

Report this snippet  

You need to login to post a comment.