# 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 . # # more odds and ends for nofork command substitution # make sure parsing is right within conditional commands [[ ${ echo -n "[${ echo -n foo; }]" ; } == '[foo]' ]] || echo bad 1 [[ "${ echo -n "[${ echo -n foo; }]" ; }" == '[foo]' ]] || echo bad 1 # mix multiple calls to parse_and_execute got=$(eval 'x=${ for i in test; do case $i in test) echo .;; esac; done; }' ; echo $x) echo $got # mix compound assignment and nofork command substitution : ${ a=(1 2 3 ${ echo 4;} ); } declare -p a unset a # function execution with side effects int=0 incr() { echo incr: $int (( int++ )) } : ${ incr; } : ${ incr; } declare -p int # expansion inside here-document body int=0 : <