diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-11-02 16:20:50 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-11-02 16:20:50 +0100 |
commit | 7c2dab07b51336a671750871f78c3f1c42c35743 (patch) | |
tree | ce6365dd78de35743bbd6ccb416400e4765dd9a5 | |
parent | aae1f618c630dd18ac2ecb843c9e70b3817d3483 (diff) | |
download | scripts-7c2dab07b51336a671750871f78c3f1c42c35743.tar.gz scripts-7c2dab07b51336a671750871f78c3f1c42c35743.zip |
Fixed scp.sh
-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*//' | |