我想做点什么:
do lots of stuff to prepare a good environement become_interactive #wait for Ctrl-D automatically clean up
bash有可能吗?如果没有,你看到另一种做同样事情的方法吗?
解决方法
结构如下:
test.sh
#!/bin/sh exec bash --rcfile environ.sh
environ.sh
cleanup() { echo "Cleaning up" } trap cleanup EXIT echo "Initializing" PS1='>> '
在行动:
~$./test.sh Initializing >> exit Cleaning up