local-bin/link.sh

20 lines
347 B
Bash
Raw Normal View History

2020-07-01 13:42:14 +03:00
#!/bin/sh
2020-12-22 06:11:00 +02:00
node=$(uname -n)
node_files=($(ls $PWD/$node))
common_files=($(ls $PWD/common))
2021-01-23 12:22:53 +02:00
dest="$HOME/.local/bin/"
2020-07-01 13:42:14 +03:00
# Ensure destination exists
if [ ! -d "$dest" ]; then
mkdir -p "$dest"
fi
2020-12-22 06:11:00 +02:00
for file in "${node_files[@]}"; do
2021-01-23 12:22:53 +02:00
ln -sf "$PWD/$node/$file" "$dest"
2020-12-22 06:11:00 +02:00
done
for file in "${common_files[@]}"; do
2021-01-23 12:22:53 +02:00
ln -sf "$PWD/common/$file" "$dest"
2020-07-01 13:42:14 +03:00
done