P粉5217482112023-09-04 17:45:03
No. The script stops after exec echo "Test"
. exec
Replace the current process (i.e. shell script) with the following command. You can verify by:
daemon="/usr/bin/mysqld --user=mysql --console --skip-name-resolve --skip-networking=0 $@" $daemon & exec echo "Test" echo "Second Test" exec fg %1
The solution is simple: don't use exec
.
BTW: It's not clear why you want to use fg
in a shell script. In an interactive shell, fg
has no function only within scripts.