-
Notifications
You must be signed in to change notification settings - Fork 0
/
03_install_autojump.sh
executable file
·37 lines (28 loc) · 1.18 KB
/
03_install_autojump.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
#!/bin/bash
# Local installation directory for Autojump
INSTALL_DIR="$HOME/.local/autojump"
# Check if git is installed
if ! command -v git &> /dev/null
then
echo "git is required but not installed. Please install git first."
exit 1
fi
# Clone the Autojump repository into the local directory
echo "Cloning Autojump repository..."
git clone [email protected]:wting/autojump.git "$INSTALL_DIR"
# Navigate to the installation directory
cd "$INSTALL_DIR" || { echo "Failed to navigate to the installation directory"; exit 1; }
# Install Autojump locally
echo "Installing Autojump..."
./install.py --dest="$HOME/.local"
# Define the exact initialization line
AUTOJUMP_INIT_LINE="[[ -s \"$HOME/.local/etc/profile.d/autojump.sh\" ]] && source \"$HOME/.local/etc/profile.d/autojump.sh\""
# Add Autojump to .zshrc if the exact line is not already there
if ! grep -Fxq "$AUTOJUMP_INIT_LINE" "$HOME/.zshrc"; then
echo "Adding Autojump initialization to .zshrc"
echo "$AUTOJUMP_INIT_LINE" >> "$HOME/.zshrc"
else
echo "Autojump initialization already present in .zshrc"
fi
echo "Autojump installation completed!"
echo "Please restart your terminal or run 'source $HOME/.zshrc' to start using Autojump."