Checking uname before trying to link node

This commit is contained in:
Siina Mashek 2021-04-09 08:56:57 +03:00
parent 95a728eba5
commit 51b18cd057

10
link.sh
View File

@ -1,7 +1,6 @@
#!/bin/sh
node=$(uname -n)
node_files=($(ls $PWD/$node))
common_files=($(ls $PWD/common))
dest="$HOME/.local/bin/"
@ -10,9 +9,12 @@ if [ ! -d "$dest" ]; then
mkdir -p "$dest"
fi
for file in "${node_files[@]}"; do
ln -sf "$PWD/$node/$file" "$dest"
done
if [ -f "$node" ]; then
node_files=($(ls $PWD/$node))
for file in "${node_files[@]}"; do
ln -sf "$PWD/$node/$file" "$dest"
done
fi
for file in "${common_files[@]}"; do
ln -sf "$PWD/common/$file" "$dest"