History

locking/atomics: Use sed(1) instead of non-standard head(1) option

POSIX says the -n option must be a positive decimal integer. Not all implementations of head(1) support negative numbers meaning offset from the end of the file. Instead, the sed expression '$d' has the same effect of removing the last line of the file.

Michael Forney committed 7 years ago

Commit ebf8d821 parent 886532a1 file · +1 −1Browse files

Unified · Split

scripts/atomic/check-atomics.sh+1−1
@@ -22,7 +22,7 @@ while read header; do · 21 unmodified lines
22 OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"22 OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})"
23 OLDSUM="${OLDSUM#// }"23 OLDSUM="${OLDSUM#// }"
24 24
25 NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)"25 NEWSUM="$(sed '$d' ${LINUXDIR}/include/${header} | sha1sum)"
26 NEWSUM="${NEWSUM%% *}"26 NEWSUM="${NEWSUM%% *}"
27 27
28 if [ "${OLDSUM}" != "${NEWSUM}" ]; then28 if [ "${OLDSUM}" != "${NEWSUM}" ]; then