D1956.sh (670B)
1 #!/usr/bin/env bash 2 3 prefix=D1956 4 5 function test1/fds { 6 local pid=$(exec sh -c 'echo "$PPID"') 7 ls -la "/proc/$pid/fd" >/dev/tty 8 } <&"$_test1_a" >&"$_test1_b" 9 10 function test1/sqlite3 { 11 exec sqlite3 -quote -cmd "-- [ble-test1: $$]" "$prefix.sqlite3" <&"$_test1_a" >&"$_test1_b" 12 } 13 14 function test1 { 15 local fa=$prefix.a.pipe 16 local fb=$prefix.b.pipe 17 rm -f "$fa" "$fb" 18 mkfifo "$fa" "$fb" 19 exec 36<> "$fa" 20 exec 37<> "$fb" 21 _test1_a=36 22 _test1_b=37 23 24 #bgpid=$(test1/sqlite3 >/dev/null & disown; echo $!) 25 bgpid=$(test1/fds >/dev/null & disown; echo $!) 26 if ! kill -0 "$bgpid"; then 27 echo 'background sqlite3 failed to start.' >&2 28 bgpid= 29 fi 30 } 31 test1