$- is "hB" if launched via command line, and it is "himBH" only when
we are actually *in* an interactive shell. so checking "test -t 1" is
what we want.
Signed-off-by: Kefu Chai <kchai@redhat.com>
local expected=5.1
local dts_ver=$1
if version_lt $old $expected; then
- case $- in
- *i*)
- # interactive shell
- cat <<EOF
+ if test -t 1; then
+ # interactive shell
+ cat <<EOF
Your GCC is too old. Please run following command to add DTS to your environment:
scl enable devtoolset-7 bash
see https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ for more details.
EOF
- ;;
- *)
- # non-interactive shell
- source /opt/rh/devtoolset-$dts_ver/enable
- ;;
- esac
+ else
+ # non-interactive shell
+ source /opt/rh/devtoolset-$dts_ver/enable
+ fi
fi
}