changes to text representation of parsed command substitution; small changes to tests

This commit is contained in:
Chet Ramey
2022-07-06 10:05:59 -04:00
parent 42768befc0
commit 67e47f224c
13 changed files with 863 additions and 1080 deletions
+15 -8
View File
@@ -53,16 +53,23 @@ unset before after
# date +%s should be portable enough now
# then try gawk, perl, python in that order
now1=$(date +%s 2>/dev/null) D=date
[ -z "$now1" ] && now1=$(gawk 'BEGIN { print systime(); }' 2>/dev/null) D=gawk
[ -z "$now1" ] && now1=$(perl -e 'print time' 2>/dev/null) D=perl
[ -z "$now1" ] && now1=$(python -c 'import time; ts = int(time.time()); print(ts)' 2>/dev/null) D=python
[ -z "$now1" ] &&
{
now1=$(gawk 'BEGIN { print systime(); }' 2>/dev/null) D=gawk
[ -z "$now1" ] && now1=$(perl -e 'print time' 2>/dev/null) D=perl
[ -z "$now1" ] && now1=$(python -c 'import time; ts = int(time.time()); print(ts)' 2>/dev/null) D=python
}
now2=$EPOCHSECONDS
case $now1 in
$now2) echo EPOCHSECONDS ok ;;
'') echo "cannot get current time using date/gawk/perl/python" >&2 ;;
*) echo "current time via $D and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
esac
# use a window of +-1 second
offset=1
if [[ -z $now1 ]]; then
echo "cannot get current time using date/gawk/perl/python" >&2
elif (( $now1 - $offset <= $now2 && $now2 <= $now1 + $offset )); then
echo EPOCHSECONDS ok
else
echo "current time via $D and EPOCHSECONDS possible mismatch|$now1|$now2|offset=$offset" >&2
fi
unset now1 now2 D
LC_ALL=C # force decimal point to `.'
+2 -1
View File
@@ -120,11 +120,12 @@ argv[3] = <ve>
5: ${x#$pat}
6: ${y#$'not'}
7: ${y#'not'}
./heredoc7.sub: line 17: warning: command substitution: 1 unterminated here-document
foo bar
./heredoc7.sub: line 21: after: command not found
./heredoc7.sub: line 29: warning: here-document at line 29 delimited by end-of-file (wanted `EOF')
./heredoc7.sub: line 29: foobar: command not found
./heredoc7.sub: line 29: EOF: command not found
./heredoc7.sub: line 30: EOF: command not found
grep: *.c: No such file or directory
comsub here-string
./heredoc.tests: line 156: warning: here-document at line 154 delimited by end-of-file (wanted `EOF')