examples: execute bash sessions in script environment
Previously, the sessions contained only explicitly exported variables and functions. This was fragile and in part buggy due to lacking exports. Interactive features like user-defined aliases and functions are still working as before.
This commit is contained in:
parent
e3a6ca3bb1
commit
719dcd77bb
@ -81,6 +81,6 @@ echo "Bitcoind data dir:"
|
|||||||
sudo ls -al /var/lib/containers/demo-node/var/lib/bitcoind
|
sudo ls -al /var/lib/containers/demo-node/var/lib/bitcoind
|
||||||
|
|
||||||
# Uncomment to start a shell session here
|
# Uncomment to start a shell session here
|
||||||
# export -f c; bash -li
|
# . start-bash-session.sh
|
||||||
|
|
||||||
# Cleanup happens at exit (see above)
|
# Cleanup happens at exit (see above)
|
||||||
|
@ -39,6 +39,6 @@ nixops deploy -d bitcoin-node
|
|||||||
nixops ssh bitcoin-node systemctl status bitcoind
|
nixops ssh bitcoin-node systemctl status bitcoind
|
||||||
|
|
||||||
# Uncomment to start a shell session here
|
# Uncomment to start a shell session here
|
||||||
# bash -li
|
# . start-bash-session.sh
|
||||||
|
|
||||||
# Cleanup happens at exit (see above)
|
# Cleanup happens at exit (see above)
|
||||||
|
@ -91,6 +91,6 @@ echo "Node info:"
|
|||||||
c nodeinfo
|
c nodeinfo
|
||||||
|
|
||||||
# Uncomment to start a shell session here
|
# Uncomment to start a shell session here
|
||||||
# export -f c; bash -li
|
# . start-bash-session.sh
|
||||||
|
|
||||||
# Cleanup happens at exit (see above)
|
# Cleanup happens at exit (see above)
|
||||||
|
6
examples/start-bash-session.sh
Normal file
6
examples/start-bash-session.sh
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Start an interactive bash session in the current bash environment.
|
||||||
|
|
||||||
|
# BASH_ENVIRONMENT contains definitions of read-only variables like 'BASHOPTS' that
|
||||||
|
# cause warnings on importing. Suppress these warnings during bash startup.
|
||||||
|
BASH_ENVIRONMENT=<(declare -p; declare -pf) \
|
||||||
|
bash --rcfile <(echo 'source $BASH_ENVIRONMENT 2>/dev/null')
|
Loading…
Reference in New Issue
Block a user