-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·90 lines (74 loc) · 2.6 KB
/
install.sh
File metadata and controls
executable file
·90 lines (74 loc) · 2.6 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
# QuickSaveAlias - Linux/Bash Installation Script
# Usage: curl -fsSL https://raw.githubusercontent.com/loganathan001/QuickSaveAlias/master/install.sh | bash
set -e
echo "🚀 Installing QuickSaveAlias for Linux/Bash..."
echo ""
# Detect if we're in the repo or need to download
if [[ -f "./quicksavealias.sh" ]]; then
echo "📁 Using local files from current directory"
SCRIPT_DIR="$(pwd)"
USE_LOCAL=1
else
echo "📥 Downloading from GitHub..."
USE_LOCAL=0
# GitHub raw URL
GITHUB_RAW_URL="https://raw.githubusercontent.com/loganathan001/QuickSaveAlias/master"
# Create temp directory
TMP_DIR=$(mktemp -d)
cd "$TMP_DIR"
# Download required file
echo " Downloading quicksavealias.sh..."
curl -fsSL "${GITHUB_RAW_URL}/quicksavealias.sh" -o quicksavealias.sh || {
echo "❌ Failed to download quicksavealias.sh"
echo " Please check the GitHub URL or clone the repository manually."
exit 1
}
SCRIPT_DIR="$TMP_DIR"
fi
echo ""
echo "📦 Installing files..."
# Backup existing file if it exists
if [[ -f ~/.quicksavealias.sh ]]; then
cp ~/.quicksavealias.sh ~/.quicksavealias.sh.backup-$(date +%Y%m%d-%H%M%S)
echo " ✓ Backed up existing ~/.quicksavealias.sh"
fi
# Install the script
cp "${SCRIPT_DIR}/quicksavealias.sh" ~/.quicksavealias.sh
chmod +x ~/.quicksavealias.sh
echo " ✓ Installed ~/.quicksavealias.sh"
echo ""
echo "⚙️ Configuring ~/.bashrc..."
# Check if already configured
if grep -q "quicksavealias.sh" ~/.bashrc 2>/dev/null; then
echo " ✓ Already configured in ~/.bashrc"
else
# Add to .bashrc
echo '' >> ~/.bashrc
echo '# QuickSaveAlias - Persistent alias management' >> ~/.bashrc
echo '[ -e ~/.quicksavealias.sh ] && source ~/.quicksavealias.sh -install' >> ~/.bashrc
echo " ✓ Added QuickSaveAlias to ~/.bashrc"
fi
# Initialize the aliases file if it doesn't exist
if [[ ! -f ~/.bash-aliases ]]; then
echo "# Bash aliases file - auto-generated by QuickSaveAlias" > ~/.bash-aliases
echo " ✓ Created ~/.bash-aliases"
fi
# Clean up temp directory if we downloaded files
if [[ $USE_LOCAL -eq 0 ]]; then
cd ~
rm -rf "$TMP_DIR"
fi
echo ""
echo "✅ Installation complete!"
echo ""
echo "📝 Next steps:"
echo " 1. Reload your shell: source ~/.bashrc"
echo " 2. Test with: alh (shows help)"
echo " 3. Create your first alias: adal test 'echo Hello!'"
echo ""
echo "📚 Documentation:"
echo " - README: https://github.com/loganathan001/QuickSaveAlias"
echo " - Run 'alh' for usage guide"
echo ""
echo "🎉 Enjoy QuickSaveAlias!"