Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Misc issues in shell scripts (codefator.io).
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 31 May 2020 21:06:15 +0000 (23:06 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Sun, 31 May 2020 21:16:08 +0000 (23:16 +0200)
examples/s4u/mc-bugged1-liveness/s4u-mc-bugged1-liveness-stack-cleaner
tools/generate-dwarf-functions
tools/internal/check_dist_archive
tools/internal/update_copyright_header

index cb32fc8..ce56584 100755 (executable)
@@ -14,7 +14,7 @@ die() {
 
 assert() {
   if ! eval "$1"; then
-    die "Assertion failed: $@"
+    die "Assertion failed: $*"
   fi
 }
 
index 301c2b5..959ba55 100755 (executable)
@@ -22,7 +22,7 @@ $HEADER
 namespace {
 const std::unordered_map<int, const char*> tagname_map = {
     {0x00, "DW_TAG_invalid"},
-$(cat "$1" | grep DW_TAG_ | sed 's/.*\(DW_TAG_[^ ]*\) = \(0x[0-9a-f]*\).*/    {\2, "\1"},/')
+$(grep DW_TAG_ -- "$1" | sed 's/.*\(DW_TAG_[^ ]*\) = \(0x[0-9a-f]*\).*/    {\2, "\1"},/')
 };
 }
 
@@ -50,7 +50,7 @@ $HEADER
 
 namespace {
 const std::unordered_map<int, const char*> attrname_map = {
-$(cat "$1" | grep DW_AT_ | sed 's/.*\(DW_AT_[^ ]*\) = \(0x[0-9a-f]*\).*/    {\2, "\1"},/')
+$(grep DW_AT_ -- "$1" | sed 's/.*\(DW_AT_[^ ]*\) = \(0x[0-9a-f]*\).*/    {\2, "\1"},/')
 };
 }
 
index 2b7247a..34da5e4 100755 (executable)
@@ -17,7 +17,7 @@ else
     interactive=0
 fi
 
-if [ $# -lt 1 -o $# -gt 3 ]; then
+if [ $# -lt 1 ] || [ $# -gt 3 ]; then
     cat >&2 <<EOF
 Usage: $0 [-batch] archive.tar.gz [git_url [git_reference]]
 EOF
index 6cccb33..eb1e9fe 100755 (executable)
@@ -35,7 +35,7 @@ get_dates() {
               s/[, ]\+/\n/g
               p
             }' "$file" \
-    | while read date; do
+    | while read -r date; do
         case "$date" in
             "")
                 ;;
@@ -54,9 +54,9 @@ format_dates() {
     local first
     local last
     local next
-    read first
+    read -r first
     last=$first
-    while read next; do
+    while read -r next; do
         if [ $next -eq $((last + 1)) ]; then
             last=$next
         else