diff options
-rwxr-xr-x | scp.sh | 21 | ||||
-rwxr-xr-x | selectAudioSink.sh | 2 |
2 files changed, 15 insertions, 8 deletions
@@ -2,13 +2,18 @@ # Allows to select a host to send files to through scp hostsfile="$HOME/.hosts" -hostnames="$(sed '/^#.*$/d; /^$/d' < "$hostsfile" | cut -d'#' -f1 | fzf)" || exit 0 -host="$(grep "$hostnames" < "$hostsfile")" -hostname="$(echo "$host" | cut -d'#' -f1)" -hostaddress="$(echo "$host" | cut -d'#' -f2)" -hostport="$(echo "$host" | cut -d'#' -f3)" -hostpass="$(echo "$host" | cut -d'#' -f4)" -targetPath="$(echo "$host" | cut -d'#' -f5)" +host="$(sed '/^#/d; /^\s*$/d' "$hostsfile" | cut -d'#' -f1 | fzf)" || exit 0 +hostline="$(grep "^${host}" "$hostsfile")" +hostname="$(echo "$hostline" | cut -d'#' -f1)" +hostaddress="$(echo "$hostline" | cut -d'#' -f2)" +hostport="$(echo "$hostline" | cut -d'#' -f3)" +hostpass="$(echo "$hostline" | cut -d'#' -f4)" +targetPath="$(echo "$hostline" | cut -d'#' -f5)" + echo "Sending to $hostname" [ "$hostpass" ] && pass -c "$hostpass" -[ "$hostport" ] && scp -r -P $hostport "$@" $hostaddress:$targetPath || scp -r "$@" $hostaddress:$targetPath # No quotes here! +if [ -n "$hostport" ]; then + scp -r -P "$hostport" "$@" "${hostaddress}:${targetPath}" +else + scp -r "$@" "${hostaddress}:${targetPath}" # No quotes here! +fi diff --git a/selectAudioSink.sh b/selectAudioSink.sh index e5b0c68..0dcbeba 100755 --- a/selectAudioSink.sh +++ b/selectAudioSink.sh @@ -4,6 +4,8 @@ # # Sets an audio sink. +LANG='en_US.UTF-8' + port="$(pactl list sinks | sed -n '/Ports/,/Active Port/p' | sed '/Ports/d;/Active/d;s/:.*$//;s/^\s*//' | |