From 82ffea992dd7dce304579544ea26aa9cc1a9339b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 13 Jan 2019 00:02:22 +0100 Subject: [PATCH] Fixed qpsh on CALMIP --- bin/qpsh | 16 +++------------- etc/qp.rc | 12 ++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bin/qpsh b/bin/qpsh index 9b5a7ff8..f7a00546 100755 --- a/bin/qpsh +++ b/bin/qpsh @@ -3,22 +3,12 @@ export QP_ROOT=$(dirname $0)/.. exec bash --init-file <(cat << EOF - [[ -f \${HOME}/.bashrc ]] && source \${HOME}/.bashrc - -ESC=\$(printf "\\e") - -function check_ezfio() { - if [[ -d \${EZFIO_FILE} ]] ; then - printf "\\e[0;32m|\${EZFIO_FILE}>\\e[m" - else - printf "\\e[0;31m|\${EZFIO_FILE}>\\e[m" - fi -} - -PS1="\${PS1%$ }\\\$(check_ezfio) \$ " source \${QP_ROOT}/quantum_package.rc +qp prompt EOF ) + + diff --git a/etc/qp.rc b/etc/qp.rc index 3c8c51a4..c1ec91a5 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -96,6 +96,18 @@ function qp() man $QP_ROOT/man/${1}.? ;; + "prompt") + shift + function _check_ezfio() { + if [[ -d ${EZFIO_FILE} ]] ; then + printf "\e[0;32m|${EZFIO_FILE}>\e[m" + else + printf "\e[0;31m|${EZFIO_FILE}>\e[m" + fi + } + PS1="${PS1%\\\$ } \$(_check_ezfio) $ " + ;; + *) _qp_usage ;;