aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscp.sh2
-rwxr-xr-xssh.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/scp.sh b/scp.sh
index 368b6bf..ca6769b 100755
--- a/scp.sh
+++ b/scp.sh
@@ -2,7 +2,7 @@
# Allows to select a host to send files to through scp
hostsfile="$HOME/.hosts"
-hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)"
+hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)" || exit 0
host="$(grep "$hostnames" < "$hostsfile")"
hostname="$(echo "$host" | cut -d'#' -f1)"
hostaddress="$(echo "$host" | cut -d'#' -f2)"
diff --git a/ssh.sh b/ssh.sh
index 50d801f..b020508 100755
--- a/ssh.sh
+++ b/ssh.sh
@@ -4,7 +4,7 @@
# Port and input for pass are optional
hostsfile="$HOME/.hosts"
-hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)"
+hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)" || exit 0
host="$(grep "$hostnames" < "$hostsfile")"
hostname="$(echo "$host" | cut -d'#' -f1)"
hostaddress="$(echo "$host" | cut -d'#' -f2)"