From 3a2a0985bb90eb1fbf5c92c3de9eb2e11d2a7869 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 17 Jul 2020 08:11:11 +0100 Subject: [PATCH] More bash bits --- bash/.bash_aliases | 3 ++- bash/.bash_functions | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bash/.bash_aliases b/bash/.bash_aliases index 266d1cc..31b3217 100644 --- a/bash/.bash_aliases +++ b/bash/.bash_aliases @@ -5,4 +5,5 @@ else alias ls="ls -F --color=auto" fi -alias tma="tmux attach" +alias t='(tmux has-session 2>/dev/null && tmux attach) || (tmux new-session)' +alias tma="tmux attach" \ No newline at end of file diff --git a/bash/.bash_functions b/bash/.bash_functions index 6d690c1..e99d460 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -25,4 +25,16 @@ function add-sshkey() { echo "No key named ${NAME} found..." fi fi +} + +# Switch to a simple prompt for demos (thanks Mark H for the idea) +function demoprompt() { + if [ ! -z ${OLDPS1+x} ]; then + PS1=$OLDPS1 + unset OLDPS1 + else + OLDPS1=$PS1 + PS1="\$ " + clear + fi } \ No newline at end of file