#!/bin/bash # Auto-generated install script for bash.kluver.de # This script downloads all .sh scripts to ~/.bash/ and makes them executable set -euo pipefail INSTALL_DIR="$HOME/.bash" SCRIPT_URL="https://bash.kluver.de/bash" BASHRC_FILE="$HOME/.bashrc" PATH_LINE='export PATH="$INSTALL_DIR:$PATH"' # Remove existing directory echo "Removing old directory: $INSTALL_DIR" rm -rf "$INSTALL_DIR" # Create fresh directory echo "Creating directory: $INSTALL_DIR" mkdir -p "$INSTALL_DIR" # Download all scripts echo "Downloading: mp3_check" curl -s -f -L "$SCRIPT_URL/mp3_check" -o "$INSTALL_DIR/mp3_check" || { echo "Error: Failed to download mp3_check" exit 1 } chmod +x "$INSTALL_DIR/mp3_check" # Add to .bashrc if not already present if ! grep -qF "$PATH_LINE" "$BASHRC_FILE" 2>/dev/null; then echo "Adding to .bashrc: $PATH_LINE" echo "" >> "$BASHRC_FILE" echo "# Added by bash.kluver.de installer" >> "$BASHRC_FILE" echo "$PATH_LINE" >> "$BASHRC_FILE" echo "" echo "Run 'source ~/.bashrc' or restart your shell to use the scripts." else echo "PATH already in .bashrc, no changes needed." fi echo "" echo "Installation complete!" echo "All scripts are now available in $INSTALL_DIR"