前任:
$read &
[1] 15139
[1]+ Stopped
$jobs -l
[1]+ 15139 Stopped (tty input) read
答案1
使用 fifo 可以轻松完成。
$ cat bar.sh
#!/bin/sh
read bar
echo got $bar in the read line
$ mkfifo foo
$ ./bar.sh < foo &
$ echo hello > foo
$ got hello in the read line
[1]+ Done ./bar.sh < foo
$