diff options
author | Florian Anderiasch <fa@art-core.org> | 2018-07-25 10:54:43 +0200 |
---|---|---|
committer | Florian Anderiasch <fa@art-core.org> | 2018-07-25 10:54:43 +0200 |
commit | bcb6339dd1d59c08d38d0fff6df5b9617898b7ad (patch) | |
tree | 35bebcc5ceafe4720f6901ab5c28d6552cf2d422 | |
parent | a6de94496a7a808afcde924c813d6ebc606b35e3 (diff) |
Replace use of 'cut' with more 'sed'
-rwxr-xr-x | echoz.sh | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -4,11 +4,11 @@ thisdir="$(dirname "$0")" pipename="${XDG_RUNTIME_DIR:-/tmp}/echoz-$$.pipe" jid="$1" password="$2" -username="$(echo "$jid" | cut -d'@' -f1)" -domain="$(echo "$jid" | cut -d'@' -f2)" -srv="$( ( dig +short SRV "_xmpp-client._tcp.$domain" || echo "0 0 5222 $domain" ) | sort -n)" -host="$(echo "$srv" | cut -d' ' -f4)" -port="$(echo "$srv" | cut -d' ' -f3)" +username="$(echo "$jid" | sed 's/@.*//')" +domain="$(echo "$jid" | sed 's/.*@//')" +srv="$( ( dig +short SRV "_xmpp-client._tcp.$domain" || echo "0 0 5222 $domain" ) | sort -n | sed 's/[[:digit:]]\+[[:space:]][[:digit:]]\+[[:space:]]//')" +host="$(echo "$srv" | sed 's/[[:digit:]]\+[[:space:]]//')" +port="$(echo "$srv" | sed 's/[[:space:]].*//')" authstr="$(echo -ne "\0$username\0$password" | base64)" rm -f "$pipename" mkfifo "$pipename" |