I would like to do something like:
do lots of stuff to prepare a good environement become_interactive #wait for Ctrl-D automatically clean up
Is this possible with bash? If not, do you see another way to do the same?
The structure looks like this:
test.sh
#!/bin/sh exec bash --rcfile environ.sh
environ.sh
cleanup() { echo "Cleaning up" } trap cleanup EXIT echo "Initializing" PS1='>> '
In action:
~$ ./test.sh Initializing >> exit Cleaning up
You can call another shell in the middle of the script, but change it, for example. environmental variables would not be reflected outside of it.
Source: https://habr.com/ru/post/1299721/More articles:Passing an argument from an incompatible pointer type warning - cNeed some help understanding pointers and memory in C - cRails - built-in list of polymorphic comments + add comment form - example? - polymorphismDefine w3wp System.Diagnostics.Process for this application pool - iisIs it better to create Oracle SQL indexes before or after loading data? - databaseA reliable way to see statistics on specific processes in the IIS6 application pool - performanceExtension of all nodes in dijit.Tree - dojoSeveral consumers and manufacturers connected to the message queue, is this possible in AMQP? - pythonMeasuring synchronization in Linux kernel mode - performanceHow to add text to PowerPoint, which when clicked is replaced by the cursor? - powerpoint-vbaAll Articles