Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sets sort file lists with error checking, use lowerc...



details:   https://anonhg.NetBSD.org/src/rev/ceeeab8e30d7
branches:  trunk
changeset: 938213:ceeeab8e30d7
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 04 12:02:20 2020 +0000

description:
sort file lists with error checking, use lowercase variable name

diffstat:

 distrib/sets/sort-list |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (17 lines):

diff -r 6d9753febcd6 -r ceeeab8e30d7 distrib/sets/sort-list
--- a/distrib/sets/sort-list    Fri Sep 04 11:43:50 2020 +0000
+++ b/distrib/sets/sort-list    Fri Sep 04 12:02:20 2020 +0000
@@ -1,7 +1,9 @@
 #!/bin/sh
+set -eu
 
-for F
-do
-       { grep '^#' "${F}"; grep -v '^#' "${F}" | LC_ALL=C sort ;} > "${F}".tmp
-       mv "${F}".tmp "${F}"
+for fname; do
+       { grep '^#' "$fname"
+         grep -v '^#' "$fname" | LC_ALL=C sort
+       } > "$fname.tmp"
+       mv "$fname.tmp" "$fname"
 done



Home | Main Index | Thread Index | Old Index