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