-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathjims_centos7_tree.sh
More file actions
executable file
·39 lines (36 loc) · 1.29 KB
/
jims_centos7_tree.sh
File metadata and controls
executable file
·39 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# The above line is called shebang.
# Author: jcbrent
# Created Date: 30 July 2017
#
# Give a tree view for those systems without Tree in BASH.
# ------------------------------------------------------------------------------------
echo " "
echo " Starting the \"CentOS 7 Tree view custom/\" Script - Named: \"jims_centos_7_tree.sh "
echo " ----------------------------------------------------------------------------- "
echo " "
echo " Author: Jim Brent "
echo " "
echo " A custom directory viewer for CentOS 7 from the current directory."
# Main body of the shell script starts here.
#
# ^ (caret) means "the beginning of the line". So "^a" means find a line starting with an "a".
shopt -s globstar
for file in **/*
do
slash=${file//[^\/]}
case "${#slash}" in
0) echo "|-- ${file}";;
1) echo "| |-- ${file}";;
2) echo "| | |-- ${file}";;
esac
done
# ------------------------------------------------------------------------------------
echo " "
echo " ----------------------------------------------------------------------------- "
echo " "
# ------------------------------------------------------------------------------------
# Exit with an explicit exit status last.
echo "Script ran successfully with an exit status of 0 (zero)."
echo " "
exit 0