local-bin/link.sh
2021-01-23 12:22:53 +02:00

20 lines
347 B
Bash
Executable File

#!/bin/sh
node=$(uname -n)
node_files=($(ls $PWD/$node))
common_files=($(ls $PWD/common))
dest="$HOME/.local/bin/"
# Ensure destination exists
if [ ! -d "$dest" ]; then
mkdir -p "$dest"
fi
for file in "${node_files[@]}"; do
ln -sf "$PWD/$node/$file" "$dest"
done
for file in "${common_files[@]}"; do
ln -sf "$PWD/common/$file" "$dest"
done