side effect on scp including JPP' setenv.sh in .bashrc
Inserting the current setenv.sh in the .bashrc, the scp command no longer works due to the use of the echo command in it. The proposed solution, solves the problem:
index b1465a5..e339975 100755
--- a/setenv.sh
+++ b/setenv.sh
@@ -1,9 +1,20 @@
#!/bin/zsh
+
+_echo() {
+ [ -z "$PS1" ] && return 0
+ echo "$@"
+}
+
+_printf() {
+ [ -z "$PS1" ] && return 0
+ printf "$@"
+}
+
# utility script for setting environment for Jpp software.
# Set environment variables for Jpp software
-echo "# Setting environment variables for Jpp software."
+_printf "# Setting environment variables for Jpp software ("
if [ $# -eq 1 ]; then
@@ -12,12 +23,14 @@ else
export JPP_DIR=`pwd -L`
fi
+_echo $(basename $JPP_DIR)")."
+
if [ ! -r $JPP_DIR/setenv.sh ]; then
- echo "ERROR: This script must be run with the correct Jpp directory."
+ _echo "ERROR: This script must be run with the correct Jpp directory."
else
if [[ -z "${ROOTSYS}" ]]; then
- echo Environment variable ROOTSYS undefined.
+ _echo Environment variable ROOTSYS undefined.
fi
source $JPP_DIR/externals/ulib/ulib.sh
The change also includes a change on environment printing including the name of the current JPP directory; it could be useful while dealing with different JPP releases.