# This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # : ${THIS_SH:=./bash} # invocation modes and errors ${THIS_SH} . #${THIS_SH} --version -c 'exit 0' bash #${THIS_SH} --help -c 'exit 0' bash ${THIS_SH} -c |& sed 's|^.*/bash|bash|' ${THIS_SH} --badopt |& sed 's|^.*/bash|bash|' ${THIS_SH} --initfile |& sed 's|^.*/bash|bash|' ${THIS_SH} -q |& sed 's|^.*/bash|bash|' export BASH_ARGV0=this-bash ${THIS_SH} -c 'echo $0 $BASH_ARGV0' unset BASH_ARGV0 { ${THIS_SH} -c 'echo $-' bash | grep c >/dev/null; } && echo '$- for -c includes c' # BASHOPTS ${THIS_SH} ./invocation1.sub # SHELLOPTS ${THIS_SH} ./invocation2.sub # rudimentary pretty-print tests ${THIS_SH} ./invocation3.sub : ${TMPDIR:=/tmp} TDIR=$TMPDIR/invocation-$$ mkdir $TDIR || exit 1 SAVEPWD=$PWD echo 'echo this is bash_logout' > $TDIR/.bash_logout HOME=$TDIR ${THIS_SH} --login -c 'logout' rm -f $TDIR/.bash_logout # script that ends with a comment and no newline printf 'echo a # comment' > $TDIR/x23.in ${THIS_SH} $TDIR/x23.in printf 'echo a' > $TDIR/x23.in ${THIS_SH} $TDIR/x23.in rm -f $TDIR/x23.in # script with invalid interpreter cat > $TDIR/x23 <