-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
62 lines (53 loc) · 1.81 KB
/
uninstall.sh
File metadata and controls
62 lines (53 loc) · 1.81 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
# Windows to Linux! (Uninstall)
# This script is used to convert Windows commands to Linux commands
# It is used to help users to find the equivalent command in Linux
# ================================================================
# Author: @Nythique: https://github.com/Nythique
# ================================================================
# Poject Name: SmoothTerminal
# Version: 1.0.0
# Operating System: Linux
# ================================================================
# ================================================================
set -e
# ────────────────────────
GREEN='\033[0;32m'
RESET='\033[0m'
# ────────────────────────
ALIAS_FILE="WinToLinux.sh"
TARGET="$HOME/WinToLinux.sh"
if [ -n "${ZSH_VERSION:-}" ]; then
RC_FILE="$HOME/.zshrc"
elif [ -n "${BASH_VERSION:-}" ]; then
RC_FILE="$HOME/.bashrc"
else
RC_FILE="$HOME/.bashrc"
fi
COLOR_ON=false
if [ -t 1 ]; then COLOR_ON=true; fi
cecho() {
if $COLOR_ON; then
echo -e "${GREEN}$1${RESET}"
else
echo "$1"
fi
}
cecho "============================================================"
cecho "=============> Starting uninstall of SmoothTerminal"
cecho "============================================================"
if [ -f "$TARGET" ]; then
rm "$TARGET"
cecho "======>[OK] Removed $TARGET"
else
cecho "======>[INFO] No file to remove at $TARGET"
fi
if grep -Fxq "source ~/WinToLinux.sh" "$RC_FILE"; then
sed -i.bak '/^source ~\/WinToLinux\.sh$/d' "$RC_FILE"
cecho "======>[OK] Removed sourcing line from $RC_FILE"
cecho "======>[INFO] Backup saved as $RC_FILE.bak"
else
cecho "======>[INFO] Sourcing line not found in $RC_FILE"
fi
clear
cecho "======>[END] Uninstall completed"
cecho "======>[INFO] Open a new terminal to apply changes"