Код: Выделить всё
1.sh
Код: Выделить всё
#!/bin/bash
for i in {1..10000}; do
echo "$i in $0"
sleep 1
done
< /code>
2.sh
Код: Выделить всё
#!/bin/bash
./1.sh &
for i in {1..10000}; do
echo "$i in $0"
sleep 1
done
< /code>
Open a terminal:
[list]
[*]run ./2.sh
[*] Закрыть терминал напрямую. grep 1.sh :
[/list]
root 4022351 1 0 19:15 ? 00:00:00 /bin/bash ./1.sh
root 4022492 4022423 0 19:16 pts/5 00:00:00 grep --color=auto 1.sh
< /code>
Why 1.sh is still running?
But if i skip step 2, and close the terminal window directly, 1.sh will also be terminated. why?
Подробнее здесь: https://stackoverflow.com/questions/795 ... ter-sighup