#!/bin/bash # Define an associative array mapping dotfile names to their corresponding paths declare -A dotfiles=( ["bashrc"]="$HOME/.bashrc" ["papes/PurplePhoneLines.jpg"]="$HOME/Pictures/Papes/PurplePhoneLines.jpg" ["local/bin"]="$HOME/.local/bin" ["config/foot"]="$HOME/.config/foot" ["config/sway"]="$HOME/.config/sway" ["config/dunst"]="$HOME/.config/dunst" ["config/i3status/"]="$HOME/.config/i3status" # Add more dotfiles here as needed ) # Function to create symbolic links create_symlink() { local source=$1 local target=$2 # Check if the target file already exists if [ -e "$target" ]; then echo "Target file '$target' already exists. Skipping..." return fi # Check if the target directory exists, if not, create it local target_dir=$(dirname "$target") if [ ! -d "$target_dir" ]; then mkdir -p "$target_dir" fi # Create symbolic link ln -s "$source" "$target" echo "Created symbolic link: $source -> $target" } # Loop through each dotfile and create symbolic links for file in "${!dotfiles[@]}"; do create_symlink "$(pwd)/$file" "${dotfiles[$file]}" done echo "Dotfile setup complete."