-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patht.sh
executable file
·37 lines (32 loc) · 879 Bytes
/
t.sh
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
#!/bin/bash
# Convenience alias for a designated bash or python script.
touch $HOME/scripts/bash/test_status.txt
doc="$HOME/scripts/bash/test_status.txt"
function run_app {
app=$(head "$doc")
extension="${app##*.}"
if [ "$extension" = "sh" ]; then
source ~/.bashrc
source $app
else
python $app
fi
}
if [ "$1" = "" ]; then
run_app
elif [ "$1" = "reset" ]; then
echo "$HOME/scripts/bash/echo_test.sh" > "$doc"
run_app
elif [ "$1" = "path" ]; then
echo && head $doc && echo
elif [ "$1" = "set" ]; then
name=$(realpath $2)
echo $name > "$doc"
echo -e "\nPath set to: $name\n"
else
echo -e "\nUsage: t <command> [path]\n"
echo "t runs app"
echo "t set sets the path to [path]"
echo "t reset resets path to echo_test.sh"
echo -e "t path prints the current path\n"
fi