mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-09 21:20:50 +02:00
changes to text representation of parsed command substitution; small changes to tests
This commit is contained in:
+15
-8
@@ -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
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user