ref
This commit is contained in:
parent
81e5d94af7
commit
f2dc60ba4d
@ -1,7 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
set -m # enable background jobs
|
|
||||||
|
|
||||||
readonly SESSION=example-background-job
|
readonly SESSION=example-background-job
|
||||||
readonly MAINW=1
|
readonly MAINW=1
|
||||||
@ -19,12 +18,7 @@ temp_script="$(mktemp)"
|
|||||||
readonly temp_script
|
readonly temp_script
|
||||||
cat > "${temp_script}" << EOF
|
cat > "${temp_script}" << EOF
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
rm \$0
|
||||||
cleanup() {
|
|
||||||
rm \$0 # remove self after exit
|
|
||||||
}
|
|
||||||
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
tmux send-keys -t "${SESSION}:${MAINW}.1" 'echo hello' Enter
|
tmux send-keys -t "${SESSION}:${MAINW}.1" 'echo hello' Enter
|
||||||
@ -33,4 +27,4 @@ tmux kill-session -t "${SESSION}"
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x "${temp_script}"
|
chmod +x "${temp_script}"
|
||||||
nohup "${temp_script}" >/dev/null & # run in background
|
setsid -f "${temp_script}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user