bin: update sshl and arg-test

This commit is contained in:
xeruf 2022-09-03 13:37:33 +02:00
parent 54a341e581
commit 15199938dc
2 changed files with 11 additions and 3 deletions

View File

@ -269,7 +269,7 @@ dns() {
drill AAAA @8.8.8.8 -Q "${arg##*/}" drill AAAA @8.8.8.8 -Q "${arg##*/}"
done done
} }
alias sshk='kitty +kitten ssh' alias sshk="$(case $TERM in (*-kitty) echo 'kitty +kitten';; esac) ssh"
sshl() { sshl() {
test "$1" = "-a" && shift && local all=true test "$1" = "-a" && shift && local all=true
lemonade server -allow 127.0.0.1 & lemonade server -allow 127.0.0.1 &
@ -286,7 +286,8 @@ sshl() {
cut -d " " -f2- | cut -d " " -f2- |
sed "s|^~|$HOME|")" "$1" && sed "s|^~|$HOME|")" "$1" &&
touch "$file" touch "$file"
$(case $TERM in (*-kitty) echo 'kitty +kitten';; esac) ssh -R 2489:127.0.0.1:2489 "$@" #TERM=xterm-256color
sshk -R 2489:127.0.0.1:2489 "$@"
fi fi
} }

View File

@ -1,8 +1,15 @@
#!/bin/sh #!/bin/sh
outfile=/tmp/args$(date +%s)
# echo "dot - graphviz version 5.0.1 (0)" >&2
{ {
echo "$# Args: ${@:-DEFAULT}" echo "$# Args: ${@:-DEFAULT}"
#echo "Starred: $*" #echo "Starred: $*"
#echo "${@:-default}" | sed 's/\w\+/\0-w/g' #echo "${@:-default}" | sed 's/\w\+/\0-w/g'
for last; do true; done for last; do true; done
echo "Last arg: $last" echo "Last arg: $last"
} | tee /tmp/args$(date +%s) } | tee "$outfile"
if tty -s || test "$1" = "-V"
then echo "Not reading from stdin"
else tee "$outfile-stdin"
fi