Skip to content

Commit 73b09ed

Browse files
authored
Merge pull request #30 from harleypig/tree_alias
added an alias for tree command if it doesnt exist on the system
2 parents 9f989cd + 610d487 commit 73b09ed

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

recipes/Bash/tree_alias/LICENSE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This work is released to the public domain under the CC0 (Creative Commons) license terms: https://creativecommons.org/publicdomain/zero/1.0/legalcode

recipes/Bash/tree_alias/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### An alias for the tree command
2+
3+
Author: Unknown
4+
Submitter: Alan Young (harleypig)
5+
6+
If the tree command does not exist on your system, this alias will fake it.
7+
8+
I got this from a co-worker a long time ago. I don't remember when, or who it was. If it was you, let me know and I'll update this.

recipes/Bash/tree_alias/tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
# I got this from a co-worker many moons ago. Unfortunately, I don't remember
4+
# who. Basically, if a tree program is not installed, fake it with this.
5+
6+
if ! command -v tree > /dev/null 2>&1; then
7+
8+
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
9+
10+
fi

0 commit comments

Comments
 (0)