tools: fix or assume some bashism
authorJean Privat <jean@pryen.org>
Thu, 5 Jan 2012 01:24:00 +0000 (20:24 -0500)
committerJean Privat <jean@pryen.org>
Thu, 5 Jan 2012 01:24:00 +0000 (20:24 -0500)
Remove some bashsims in git-gen-version.sh and nc.
Change the #! in showerr.sh to bash.

Signed-off-by: Jean Privat <jean@pryen.org>

src/git-gen-version.sh
src/nc
src/showerr.sh

index b21d8bb..e018dc6 100755 (executable)
@@ -20,7 +20,9 @@
 # The version number is stored in a dedicated Nit module.
 
 gen_version() {
-       if ! grep "$*" nit_version.nit >/dev/null 2>&1; then
+       if grep "$*" nit_version.nit >/dev/null 2>&1; then
+               :
+       else
                cat > nit_version.nit<<END
 # This file was generated by git-gen-version.sh
 package nit_version
@@ -40,7 +42,7 @@ if [ ! -f nitc.nit ]; then
        fi
 fi
 
-VN=$(git describe --always HEAD 2>/dev/null)
+VN=`git describe --always HEAD 2>/dev/null`
 if [ "$?" != "0" ]; then
        if [ -r ../VERSION ]; then
                VN="$(cat ../VERSION)"
diff --git a/src/nc b/src/nc
index 9672e88..8a382c0 100755 (executable)
--- a/src/nc
+++ b/src/nc
 
 NITC="../c_src/nitc"
 NITCOPTS="-v -W"
-CSRC=$( (cd ../c_src; pwd) )
+CSRC=$` (cd ../c_src; pwd) `
 
 trap_action() {
-       test -n $sub_command && kill $sub_command
-       test -e $pipe && rm -f $pipe
+       test -n "$sub_command" && kill $sub_command
+       test -e "$pipe" && rm -f $pipe
        exit 1
 }
 
@@ -39,8 +39,8 @@ esac
 
 trap trap_action INT TERM
 echo ${NITC} ${NITCOPTS} ${opts} "$@"
-pipe=$(mktemp nc.stderr.XXXXX)
-rm "$pipe"
+pipe=$`mktemp nc.stderr.XXXXX`
+rm "$pipe" 2>/dev/null
 mkfifo "$pipe"
 ./showerr.sh <"$pipe" &
 sub_command=$!
index 831acca..db057e5 100755 (executable)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 # This file is part of NIT ( http://www.nitlanguage.org ).
 #
 # Copyright 2008 Jean Privat <jean@pryen.org>