Created
November 24, 2020 09:16
-
-
Save MalteT/9e0ee9ce63912ebfbe0cbc9c7e6c01dc to your computer and use it in GitHub Desktop.
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
| #!/bin/sh | |
| # Auto cd into sub-dirs as long as it's the only file in a directory | |
| function deepcd { | |
| cd $1 | |
| if [ $(ls -l | wc -l) -eq 2 ]; then | |
| only_thing_here=$(ls) | |
| if [ -d "$only_thing_here" ]; then | |
| deepcd "$only_thing_here" | |
| fi | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment