summaryrefslogtreecommitdiffstats
path: root/noise
diff options
context:
space:
mode:
authortv <tv@also>2010-04-26 16:33:52 +0200
committertv <tv@also>2010-04-26 16:33:52 +0200
commitdb8d3910efdaf735fa51f012fb48b52e23f25c4c (patch)
treee7132af11e42cbd0cfb50149f0677761155e231e /noise
parent50aa02ccf1de40bc5f518d212a89c587c2b7d859 (diff)
Reap child processes on EXIT
Diffstat (limited to 'noise')
-rwxr-xr-xnoise34
1 files changed, 8 insertions, 26 deletions
diff --git a/noise b/noise
index 481f2c09..fe67052c 100755
--- a/noise
+++ b/noise
@@ -6,7 +6,7 @@ noise_set() { # set a variable
s/^noise_([[:alnum:]_]+)=(.*)$/\1 = \2/p
' | sort
elif test "x$2" = x ; then
- eval "echo \"$1 is \$noise_$1\""
+ eval "echo \"$1 = \$noise_$1\""
else
if echo "$1" | grep -q '[^[:alnum:]_]' ; then
fail invalid variable name "$1"
@@ -35,8 +35,13 @@ fail() {
return 23
}
+cleanup() {
+ rm -f $linefeed
+ kill $jobs
+}
+
linefeed="/tmp/noise-client-$$"
-trap "rm -f $linefeed" EXIT
+trap cleanup EXIT
mkfifo $linefeed
while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn "
s:^/([a-z]+)([[:space:]]+(.*))?$:command='\1'; args='\3';:p;t
@@ -60,6 +65,7 @@ while eval `{ read && echo $REPLY ; } | tr -d \' | sed -rn "
##
fail unknown command "$command"
done <$linefeed &
+jobs="${jobs+$jobs }`jobs -p`"
cat<<EOF
welcome to SHACK UTTERANCE version 0.9 beta 2
get help with /help
@@ -76,27 +82,3 @@ $REPLY
EOF
done
#### end of file.
-
-
-
-
-exit
-modcall() {
- for dir in `echo "$NOISE_PATH" | tr : \ ` ; do
- module="$dir/$1"
- if test -x "$module" ; then
- shift
- "$module" "$@"
- : && return
- fi
- done
- return 23
-}
-
-funcall() {
- if type noise_"$1" &>/dev/null ; then
- noise_"$@"
- : && return
- fi
- return 23
-}