Skip to content

Instantly share code, notes, and snippets.

@ChieftainY2k
Last active June 19, 2024 08:04
Show Gist options
  • Save ChieftainY2k/e43cc74fef2b17bd2b251d43099c3135 to your computer and use it in GitHub Desktop.
Save ChieftainY2k/e43cc74fef2b17bd2b251d43099c3135 to your computer and use it in GitHub Desktop.
My private screen session for shared shell environments
#!/bin/bash
set -e
NAMESPACE=${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=youname $0"
echo "Press ENTER to continue or Ctrl-C to exit"
echo "************************************************************************************************************"
read
export HISTFILE=/home/$USER/.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