Created
May 12, 2013 15:02
-
-
Save jsocol/5563847 to your computer and use it in GitHub Desktop.
Change directories and list contents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # I found myself doing this a lot: cd path/<enter>ls<enter> and thought "that's silly". | |
| # Put this in your .bashrc or another file that is sourced (*not* executed) into your | |
| # shell environment. Then you'll have the "lcd" command available. | |
| # Change directory and list contents. | |
| lcd () { | |
| if [ $# -eq 1 ]; then | |
| cd $1 && ls | |
| elif [ $# -eq 2 ]; then | |
| cd $2 && ls $1 | |
| else | |
| echo "USAGE: $0 [options] path" | |
| exit 1 | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment