mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-12 13:10:45 +02:00
change to behavior of '&' in pattern substitution replacement string; fix for blank lines in multiline commands saved in command history
This commit is contained in:
+9
-4
@@ -50,15 +50,20 @@ unset before after
|
||||
# EPOCHSECONDS
|
||||
|
||||
# not exact, but should work
|
||||
# could also use python -c 'import time; ts = int(time.time()); print(ts)'
|
||||
now1=$(perl -e 'print time')
|
||||
# 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
|
||||
now2=$EPOCHSECONDS
|
||||
|
||||
case $now1 in
|
||||
$now2) echo EPOCHSECONDS ok ;;
|
||||
*) echo "current time via perl and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
|
||||
'') echo "cannot get current time using date/gawk/perl/python" >&2 ;;
|
||||
*) echo "current time via $D and EPOCHSECONDS possible mismatch|$now1|$now2" >&2 ;;
|
||||
esac
|
||||
unset now1 now2
|
||||
unset now1 now2 D
|
||||
|
||||
LC_ALL=C # force decimal point to `.'
|
||||
now1=$EPOCHREALTIME
|
||||
|
||||
Reference in New Issue
Block a user