From 51b18cd05710515350353c08f6da4a5e0f1b47cf Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Fri, 9 Apr 2021 08:56:57 +0300 Subject: [PATCH] Checking uname before trying to link node --- link.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/link.sh b/link.sh index dca643a..f820f7e 100755 --- a/link.sh +++ b/link.sh @@ -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"