From f7030d565f5cb492c7c8977fed7aff2412a88b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Thu, 29 Nov 2018 13:25:35 +0100 Subject: functions: stylistic tweaks --- shellrc.d/function | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shellrc.d/function b/shellrc.d/function index 06a36fd..cb316b4 100644 --- a/shellrc.d/function +++ b/shellrc.d/function @@ -3,7 +3,7 @@ # Run process in background tbg() { mkdir -p /tmp/tbg-log - nohup "$@" >/dev/null >/tmp/tbg-log/$0-$(date +%g%m%d%H%M%S%N) & + nohup "$@" >/dev/null >"/tmp/tbg-log/$0-$(date +%g%m%d%H%M%S%N)" & } # Generate random password (optionally takes length of password as first argument) @@ -32,7 +32,7 @@ dorepeat() { } # Clear all ssh control masters -ssh-clear() { +sshclear() { rm -rf ~/.cache/ssh mkdir -p ~/.cache/ssh } @@ -48,10 +48,11 @@ chroot-bash() { inrun () { ( set -e - local TMPFS="$(mktemp --tmpdir inrun.XXXXXXXX)" - trap "rm '$TMPFS'; trap '' EXIT; exit 0" EXIT INT QUIT TERM ABRT + local tmpfs + tmpfs="$(mktemp --tmpdir inrun.XXXXXXXX)" + trap "rm '\$tmpfs'; trap '' EXIT; exit 0" EXIT INT QUIT TERM ABRT while [ $# -gt 0 -a "$1" != "--" ]; do - echo "$1" >> "$TMPFS" + echo "$1" >> "$tmpfs" shift done if [ $# -le 1 ]; then @@ -60,7 +61,7 @@ inrun () { fi shift while true; do - inotifywait -qe close_write --fromfile "$TMPFS" || true + inotifywait -qe close_write --fromfile "$tmpfs" || true "$@" || true done ) -- cgit v1.2.3