local-bin/link.sh

22 lines
378 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)
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
if [ -d "$node" ]; then
node_files=($(ls $PWD/$node))
for file in "${node_files[@]}"; do
ln -sf "$PWD/$node/$file" "$dest"
done
fi
2020-12-22 06:11:00 +02:00
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