31 lines
996 B
Bash
31 lines
996 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Define variables
|
||
|
SCRIPT_URL="https://git.fascinated.cc/Fascinated/linux-scripts/raw/branch/master/paste.sh"
|
||
|
SCRIPT_NAME="paste.sh"
|
||
|
PROFILE_FILE="$HOME/.bashrc" # Use .bash_profile for MacOS or if preferred
|
||
|
|
||
|
# Download the script
|
||
|
echo "Downloading $SCRIPT_NAME from $SCRIPT_URL..."
|
||
|
curl -o $SCRIPT_NAME $SCRIPT_URL
|
||
|
|
||
|
# Make the script executable
|
||
|
echo "Making $SCRIPT_NAME executable..."
|
||
|
chmod +x $SCRIPT_NAME
|
||
|
|
||
|
# Move script to the home directory
|
||
|
mv $SCRIPT_NAME $HOME
|
||
|
|
||
|
# Insert alias into profile file if not already present
|
||
|
ALIAS_COMMAND="alias paste=\"$HOME/$SCRIPT_NAME\""
|
||
|
if ! grep -q "$ALIAS_COMMAND" "$PROFILE_FILE"; then
|
||
|
echo "Adding alias to $PROFILE_FILE..."
|
||
|
echo "$ALIAS_COMMAND" >> "$PROFILE_FILE"
|
||
|
echo "Alias added. Please restart your terminal or run 'source $PROFILE_FILE' to apply changes."
|
||
|
else
|
||
|
echo "Alias already present in $PROFILE_FILE."
|
||
|
fi
|
||
|
|
||
|
# Inform the user that the setup is complete
|
||
|
echo "Setup complete. You can now use the 'paste' command."
|