Run commands in the background; fix quotation bug
Now running a command doesn’t block shellfox.sh, and commands with quotes should work like normal.
This commit is contained in:
parent
9000b2a3b0
commit
55edbb1fc7
13
shellfox.sh
13
shellfox.sh
|
@ -25,8 +25,15 @@ read_message() {
|
|||
}
|
||||
|
||||
|
||||
# Deescape a JSON stream from input.
|
||||
json_deescape() {
|
||||
sed 's/^"//' \
|
||||
| sed 's/"$//' \
|
||||
| sed 's/\"/"/g'
|
||||
}
|
||||
|
||||
|
||||
while true; do
|
||||
message="$(read_message)"
|
||||
command="$(echo "$message" | sed 's/^"//' | sed 's/"$//')"
|
||||
"$SHELL" -c "$command"
|
||||
command="$(read_message | json_deescape)"
|
||||
nohup "$SHELL" -c "$command" > /dev/null &
|
||||
done
|
||||
|
|
Ŝarĝante…
Reference in New Issue