Skip to content

Instantly share code, notes, and snippets.

@ChieftainY2k
Last active July 2, 2024 09:14
Show Gist options
  • Save ChieftainY2k/439a4030f47b9416f6e56fb6538ca4db to your computer and use it in GitHub Desktop.
Save ChieftainY2k/439a4030f47b9416f6e56fb6538ca4db to your computer and use it in GitHub Desktop.
Namespaced screen with separate bash history
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