Skip to content

Instantly share code, notes, and snippets.

@tnn4
Last active April 29, 2025 21:46
Show Gist options
  • Save tnn4/e033e0640b32cbf5d399594be9678292 to your computer and use it in GitHub Desktop.
Save tnn4/e033e0640b32cbf5d399594be9678292 to your computer and use it in GitHub Desktop.
making and removing symlinks

see: https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash

#!/bin/bash

# see: https://stackoverflow.com/questions/1494178/how-to-define-hash-tables-in-bash

# Create symlinks
# ln -s /path/to/file /path/to/symlink # path >> linkname

# remove symlinks
# ln -sf /path/to/file /path/to/symlink

declare -A symlink_list

love2d="~/bin/love-11.5-x86_64.AppImage"

symlink_list=( ["love"]=${love2d} )

for link in "${!symlink_list[@]}";do
    ln -s ${symlink_list[${link}]} ${link} 
    echo "Creating symlink ${link} >> ${symlink_list[${link}]}"
done

# Remove symlinks
# for item in "${!symlink_list[@]}";do
#    ln -sf ${symlink_list[${link}]} ${link}
#    echo "Removing symlink ${symlink_list[${link}]} >> ${link}"
# done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment