aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2019-05-23 13:32:14 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2019-05-23 13:32:14 +0200
commitcec6026bcb326f73310213f4fb958619a045c37f (patch)
treea71d34b8b98554b9081a20a8b437473d59cd60cf
parent7cde0dc02c0a8349ab7769f934a29cf1578995b5 (diff)
downloadscripts-cec6026bcb326f73310213f4fb958619a045c37f.tar.gz
scripts-cec6026bcb326f73310213f4fb958619a045c37f.zip
Changed ssh.sh and scp.sh to allow for comments on hosts file.
-rwxr-xr-xscp.sh2
-rwxr-xr-xssh.sh2
2 files changed, 2 insertions, 2 deletions
diff --git a/scp.sh b/scp.sh
index b01721f..27b23fd 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="$(cut -d'#' -f1 < "$hostsfile" | fzf)"
+hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)"
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 d049de1..50d801f 100755
--- a/ssh.sh
+++ b/ssh.sh
@@ -4,7 +4,7 @@
# Port and input for pass are optional
hostsfile="$HOME/.hosts"
-hostnames="$(cut -d'#' -f1 < "$hostsfile" | fzf)"
+hostnames="$(sed '/^#.*$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)"
host="$(grep "$hostnames" < "$hostsfile")"
hostname="$(echo "$host" | cut -d'#' -f1)"
hostaddress="$(echo "$host" | cut -d'#' -f2)"