Last active
July 2, 2024 09:14
-
-
Save ChieftainY2k/439a4030f47b9416f6e56fb6538ca4db to your computer and use it in GitHub Desktop.
Namespaced screen with separate bash history
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
NAMESPACE=${N:-${NAMESPACE:-default}} | |
echo "************************************************************************************************************" | |
echo "This screen session is for namespace \"${NAMESPACE}\" " | |
echo "If you are not the owner of this namespace please exit now (Ctrl-C) , thanks :)" | |
echo "If you want to use your own screen namespace, use: NAMESPACE=yourname $0 or N=yourname $0" | |
echo "Press ENTER to continue or Ctrl-C to exit" | |
echo "************************************************************************************************************" | |
read | |
export HISTFILE=$HOME/.bash_history_${NAMESPACE} | |
touch ${HISTFILE} | |
screen -dr ${NAMESPACE} || screen -S ${NAMESPACE} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment