2012-04-09 42 views
1

我写了一个脚本来做一些备份。有一个if区块要求确认:如何在bash脚本中添加一个信号?

read -p "Do you want to continue? [y/n]" confirm 

if [[ ${confirm} == "n" ]]; then 
    # do something like CTRL+Z, and halt until I run fg <job number> to activate this script 
else 
    # do some stuff 
fi 

任何人都可以帮忙吗?

回答

3

您可以使用kill -STOP $$或在bash中,您可以使用suspend命令。