-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetupCommands.sh
More file actions
executable file
·65 lines (55 loc) · 1.55 KB
/
setupCommands.sh
File metadata and controls
executable file
·65 lines (55 loc) · 1.55 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# setupCommands.sh - A script that will ask to run different commands that get exported to .bashrc and /root/.bashrc
# Didn't mean for this to become a whole shell script, but because of how bash works, I was forced to
# Note: I will NOT be tracking changes to this script! Also, I wouldn't run this by itself!
### Variables
lngName="setupCommands"
shortName="sc"
### Functions
if [[ -f commonFunctions.sh ]]; then
source commonFunctions.sh
elif [[ -f /usr/share/commonFunctions.sh ]]; then
source /usr/share/commonFunctions.sh
else
echo "commonFunctions.sh could not be located!"
# Comment/uncomment below depending on if script actually uses common functions
echo "Script will now exit, please put file in same directory as script, or link to /usr/share!"
exit 1
fi
function uecho() {
getUserAnswer "Would you like to run $@ as $USER?"
case $? in
0)
debug "Running $@ as $USER"
echo "$@" | tee -a ~/.bashrc
;;
1)
debug "Not running $@ for $USER"
;;
*)
debug "ERROR: Unexpected value for uecho() in $0"
exit 1
;;
esac
getUserAnswer "Would you like to run $@ as root?"
case $? in
0)
debug "Running $@ as root"
echo "$@" | sudo tee -a /root/.bashrc
;;
1)
debug "Not running $@ for root"
;;
*)
debug "ERROR: Unexpected value for uecho() in $0"
exit 1
;;
esac
}
### Main Script
# If you value your sanity, NEVER delete the following line!
uecho "PATH=$PATH:/usr/games" # Do not run this as USER, only as root!
uecho "export PATH" # Do not run a USER, only as root!
uecho "fortune | cowsay | lolcat"
#EOF