aboutsummaryrefslogtreecommitdiff
path: root/shellrc.d/function
diff options
context:
space:
mode:
authorKarel Kočí <karel.koci@nic.cz>2018-11-29 13:25:35 +0100
committerKarel Kočí <karel.koci@nic.cz>2018-11-29 13:25:35 +0100
commitf7030d565f5cb492c7c8977fed7aff2412a88b0c (patch)
treec2a6bce9ea50832fe0f6ccb9c74bc0b5a4f54b91 /shellrc.d/function
parent001e4f345bb8e267844f0eb7dafcbd824a3832f2 (diff)
downloadshellrc-f7030d565f5cb492c7c8977fed7aff2412a88b0c.tar.gz
shellrc-f7030d565f5cb492c7c8977fed7aff2412a88b0c.tar.bz2
shellrc-f7030d565f5cb492c7c8977fed7aff2412a88b0c.zip
functions: stylistic tweaks
Diffstat (limited to 'shellrc.d/function')
-rw-r--r--shellrc.d/function13
1 files 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
)