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:
Jaidyn Ann 2024-02-28 21:57:28 -06:00
parent 9000b2a3b0
commit 55edbb1fc7

View File

@ -25,8 +25,15 @@ read_message() {
} }
# Deescape a JSON stream from input.
json_deescape() {
sed 's/^"//' \
| sed 's/"$//' \
| sed 's/\"/"/g'
}
while true; do while true; do
message="$(read_message)" command="$(read_message | json_deescape)"
command="$(echo "$message" | sed 's/^"//' | sed 's/"$//')" nohup "$SHELL" -c "$command" > /dev/null &
"$SHELL" -c "$command"
done done