[pisa-src] r914 - in trunk: auto-update/package/auto-update/files pairing pisacd pisasd test/packaging tools tools/convenience-scripts tools/tunnel

  • From: Diego Biurrun <diego@xxxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 02 Sep 2009 17:02:27 +0200

Author: biurrun
Date: Wed Sep  2 17:02:26 2009
New Revision: 914

Log:
Use $( ) syntax instead of backticks.
The former is easier to nest and should thus be preferred.

Modified:
   trunk/auto-update/package/auto-update/files/get-mac
   trunk/pairing/remake
   trunk/pisacd/check_hipd.sh
   trunk/pisasd/check_hipd.sh
   trunk/test/packaging/create-package.sh
   trunk/test/packaging/debian-init.d-pisacd
   trunk/test/packaging/debian-init.d-pisand
   trunk/test/packaging/debian-init.d-pisasd
   trunk/tools/NokiaN810_BEX_Perf.sh
   trunk/tools/caphip
   trunk/tools/convenience-scripts/hipdump
   trunk/tools/switch-ip
   trunk/tools/switch-ip.bareasus
   trunk/tools/switch-ip.owrtasus
   trunk/tools/tunnel/seteth1address

Modified: trunk/auto-update/package/auto-update/files/get-mac
==============================================================================
--- trunk/auto-update/package/auto-update/files/get-mac Wed Sep  2 16:35:26 
2009        (r913)
+++ trunk/auto-update/package/auto-update/files/get-mac Wed Sep  2 17:02:26 
2009        (r914)
@@ -10,7 +10,7 @@
 
 INTERFACE="eth0"
 MACSTRING="HWaddr"
-MACADDR=`ifconfig ${INTERFACE} | grep "${MACSTRING}" | cut -c 
${MACPOS1}-${MACPOS2}`
+MACADDR=$(ifconfig ${INTERFACE} | grep "${MACSTRING}" | cut -c 
${MACPOS1}-${MACPOS2})
 echo ${MACADDR}
 
 

Modified: trunk/pairing/remake
==============================================================================
--- trunk/pairing/remake        Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/pairing/remake        Wed Sep  2 17:02:26 2009        (r914)
@@ -4,9 +4,9 @@
 
 make clean
 clear
-RESULTS=`make`
+RESULTS=$(make)
 RETURN=$?
-RESULTS2=`echo $RESULTS | grep '(warning|error)'`
+RESULTS2=$(echo $RESULTS | grep '(warning|error)')
 echo $RESULTS2
 
 if test $RETURN -eq 0

Modified: trunk/pisacd/check_hipd.sh
==============================================================================
--- trunk/pisacd/check_hipd.sh  Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/pisacd/check_hipd.sh  Wed Sep  2 17:02:26 2009        (r914)
@@ -8,7 +8,7 @@
 hipd_running {
        if [ -e $HIPD_LOCKFILE ] # lockfile exits?
        then
-               PID=`cat $HIPD_LOCKFILE` # process id is in lockfile
+               PID=$(cat $HIPD_LOCKFILE) # process id is in lockfile
                if ps -p $PID > /dev/null # true if process is running
                then
                        return 0

Modified: trunk/pisasd/check_hipd.sh
==============================================================================
--- trunk/pisasd/check_hipd.sh  Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/pisasd/check_hipd.sh  Wed Sep  2 17:02:26 2009        (r914)
@@ -8,7 +8,7 @@
 hipd_running {
        if [ -e $HIPD_LOCKFILE ] # lockfile exits?
        then
-               PID=`cat $HIPD_LOCKFILE` # process id is in lockfile
+               PID=$(cat $HIPD_LOCKFILE) # process id is in lockfile
                if ps -p $PID > /dev/null # true if process is running
                then
                        return 0

Modified: trunk/test/packaging/create-package.sh
==============================================================================
--- trunk/test/packaging/create-package.sh      Wed Sep  2 16:35:26 2009        
(r913)
+++ trunk/test/packaging/create-package.sh      Wed Sep  2 17:02:26 2009        
(r914)
@@ -23,13 +23,13 @@
 RSYNC_OPTS=-uvr
 REPO_USER=pisa
 REPO_GROUP=pisa
-SPECFILE_DIR=`mktemp -d`
+SPECFILE_DIR=$(mktemp -d)
 SPECFILE=$SPECFILE_DIR/pisa.spec 
 RELEASE_VERSION_FILE=$PKGROOT/release.version
 
 inc_release_number()
 {
-    TMPFILE=`mktemp`
+    TMPFILE=$(mktemp)
     awk \
     '{ \
         if ($1 == "Release:") { \
@@ -91,7 +91,7 @@
 {
     ORIG=$PWD
     cd $PKG_DIR
-    WD=`echo $PKG_WEB_DIR|sed 's/\//\\\\\//g'`
+    WD=$(echo $PKG_WEB_DIR | sed 's/\//\\\\\//g')
     #dpkg-scanpackages --multiversion . |
     dpkg-scanpackages . | \
        sed "s/Filename: \./Filename: $WD/" | \
@@ -178,14 +178,14 @@
 if test -r /etc/debian_version
 then
     DISTROBASE=debian
-    ARCH=`dpkg --print-architecture`
+    ARCH=$(dpkg --print-architecture)
     PKG_DIR=$DEBDIR/DEBS/$ARCH 
-    DISTRO_RELEASE=`lsb_release -c|cut -f2`
-    DISTRO=`lsb_release -d|cut -f2|tr '[:upper:]' '[:lower:]'|cut -d" " -f1`
+    DISTRO_RELEASE=$(lsb_release -c|cut -f2)
+    DISTRO=$(lsb_release -d | cut -f2 | tr '[:upper:]' '[:lower:]' | cut -d" " 
-f1)
     PKG_WEB_DIR=dists/$DISTRO_RELEASE/$VERSION/binary-${ARCH}
     PKG_SERVER_DIR=$REPO_BASE/$DISTRO/$PKG_WEB_DIR
     cat $PKGEXE/pisa-deb.spec >> $SPECFILE
-    VERSION=`grep Version: $SPECFILE|cut -d" " -f2|xargs echo -n`
+    VERSION=$(grep Version: $SPECFILE | cut -d" " -f2 | xargs echo -n)
     DISTRO_PKG_SUFFIX=deb
     PKG_INDEX_NAME=Packages.gz
     PKG_INDEX_DIR=$PKGEXE
@@ -193,14 +193,14 @@
 elif test -r /etc/redhat-release
 then
     DISTROBASE=redhat
-    ARCH=`uname -i`
+    ARCH=$(uname -i)
     PKG_DIR=$RPMDIR/RPMS/$ARCH
-    DISTRO_RELEASE=`lsb_release -r|cut -f2`
-    DISTRO=`lsb_release -d|cut -f2|tr '[:upper:]' '[:lower:]'|cut -d" " -f1`
+    DISTRO_RELEASE=$(lsb_release -r | cut -f2)
+    DISTRO=$(lsb_release -d | cut -f2 | tr '[:upper:]' '[:lower:]' | cut -d" " 
-f1)
     PKG_WEB_DIR=fedora/base/$DISTRO_RELEASE/$ARCH
     PKG_SERVER_DIR=$REPO_BASE/$PKG_WEB_DIR
     cat $PKGEXE/pisa-rpm.spec >> $SPECFILE
-    VERSION=`grep Version: $SPECFILE|cut -d" " -f2|xargs echo -n`
+    VERSION=$(grep Version: $SPECFILE | cut -d" " -f2 | xargs echo -n)
     DISTRO_PKG_SUFFIX=rpm
     PKG_INDEX_NAME=repodata
     PKG_INDEX_DIR=$PKGEXE

Modified: trunk/test/packaging/debian-init.d-pisacd
==============================================================================
--- trunk/test/packaging/debian-init.d-pisacd   Wed Sep  2 16:35:26 2009        
(r913)
+++ trunk/test/packaging/debian-init.d-pisacd   Wed Sep  2 17:02:26 2009        
(r914)
@@ -3,7 +3,7 @@
 
 PISACD_OPTS=""
 #PIDFILE=/var/run/pisacd.pid
-PID=`pidof -o $$ pisacd`
+PID=$(pidof -o $$ pisacd)
 
 set -e
 

Modified: trunk/test/packaging/debian-init.d-pisand
==============================================================================
--- trunk/test/packaging/debian-init.d-pisand   Wed Sep  2 16:35:26 2009        
(r913)
+++ trunk/test/packaging/debian-init.d-pisand   Wed Sep  2 17:02:26 2009        
(r914)
@@ -3,7 +3,7 @@
 
 PISAND_OPTS=""
 #PIDFILE=/var/run/pisand.pid
-PID=`pidof -o $$ pisand`
+PID=$(pidof -o $$ pisand)
 
 set -e
 

Modified: trunk/test/packaging/debian-init.d-pisasd
==============================================================================
--- trunk/test/packaging/debian-init.d-pisasd   Wed Sep  2 16:35:26 2009        
(r913)
+++ trunk/test/packaging/debian-init.d-pisasd   Wed Sep  2 17:02:26 2009        
(r914)
@@ -3,7 +3,7 @@
 
 PISASD_OPTS=""
 #PIDFILE=/var/run/pisasd.pid
-PID=`pidof -o $$ pisasd`
+PID=$(pidof -o $$ pisasd)
 
 set -e
 

Modified: trunk/tools/NokiaN810_BEX_Perf.sh
==============================================================================
--- trunk/tools/NokiaN810_BEX_Perf.sh   Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/NokiaN810_BEX_Perf.sh   Wed Sep  2 17:02:26 2009        (r914)
@@ -8,20 +8,20 @@
 then
  echo "Starting with $3 loops."
 else
- echo "Usage `basename $0` host port number_of_loops"
+ echo "Usage $(basename $0) host port number_of_loops"
  exit $E_BADARGS
 fi
-x=`date +%s`
-for a in `seq $3`
+x=$(date +%s)
+for a in $(seq $3)
 do
-echo `conntest-client-hip $1 tcp $2 <<"Test" >/dev/null 2>/dev/null
+echo $(conntest-client-hip $1 tcp $2 <<"Test" >/dev/null 2>/dev/null
  Test
- ` >/dev/null
+ ) >/dev/null
 hipconf rst all >/dev/null 2>/dev/null
 sleep $4
 echo "Try #$a completed"
 done
-y=`date +%s`
+y=$(date +%s)
 z=$(($y-$x))
 echo "------------------------------------"
 echo "Used time for $3 Base exchanges: $z sec, including $4 sec sleeping 
between each loop"

Modified: trunk/tools/caphip
==============================================================================
--- trunk/tools/caphip  Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/caphip  Wed Sep  2 17:02:26 2009        (r914)
@@ -20,7 +20,7 @@
        exit 0
 }
 
-args=`getopt hi:o: $*`
+args=$(getopt hi:o: $*)
 set -- $args
 
 while getopts "hi:o:" FLAG; do

Modified: trunk/tools/convenience-scripts/hipdump
==============================================================================
--- trunk/tools/convenience-scripts/hipdump     Wed Sep  2 16:35:26 2009        
(r913)
+++ trunk/tools/convenience-scripts/hipdump     Wed Sep  2 17:02:26 2009        
(r914)
@@ -5,13 +5,13 @@
 
 case $( hostname ) in
   $HOSTNAME_INITIATOR)
-    LOCATION="$DIR_TRACES`date +%y%m%d`-ini-`date +%H%M`.trace"
+    LOCATION="$DIR_TRACES$(date +%y%m%d)-ini-$(date +%H%M).trace"
     ;;
   $HOSTNAME_MIDDLEBOX)
-    LOCATION="$DIR_TRACES`date +%y%m%d`-mid-`date +%H%M`.trace"
+    LOCATION="$DIR_TRACES$(date +%y%m%d)-mid-$(date +%H%M).trace"
     ;;
   $HOSTNAME_RESPONDER)
-    LOCATION="$DIR_TRACES`date +%y%m%d`-res-`date +%H%M`.trace"
+    LOCATION="$DIR_TRACES$(date +%y%m%d)-res-$(date +%H%M).trace"
     ;;
   *)
     echo "unknown hostname. Set hostnames in tools.conf"

Modified: trunk/tools/switch-ip
==============================================================================
--- trunk/tools/switch-ip       Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/switch-ip       Wed Sep  2 17:02:26 2009        (r914)
@@ -67,11 +67,11 @@
 
 usage() {
        echo ""
-       echo "`basename $0`: a handover testing script,"
+       echo "$(basename $0): a handover testing script,"
        echo "        designed for switching IP between two access points."
        echo "        This script must be executed with root privilege."
        echo ""
-       echo "Usage: `basename $0` [command] [options]"
+       echo "Usage: $(basename $0) [command] [options]"
        echo ""
        echo "[command] can be one of them:"
        echo " ifconfig: do ifconfig and iwconfig with static IP addresses 
(default)"
@@ -103,7 +103,7 @@
        exit 0
 fi
 
-if [ `whoami` != "root" ]; then
+if [ $(whoami) != "root" ]; then
        echo "You must be root to run this script!"
        exit 1
 fi
@@ -184,7 +184,7 @@
 done
 
 
-OLD_SSID=`iwgetid $IFWLAN |grep -i ESSID|sed "s/.*ESSID:\"\(.*\)\".*/\1/g"`
+OLD_SSID=$(iwgetid $IFWLAN | grep -i ESSID | sed "s/.*ESSID:\"\(.*\)\".*/\1/g")
 if [ "$OLD_SSID" = "$APSSID1" ]; then
        NEW_SSID="$APSSID2"
        NEW_IP="$MYIP2"

Modified: trunk/tools/switch-ip.bareasus
==============================================================================
--- trunk/tools/switch-ip.bareasus      Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/switch-ip.bareasus      Wed Sep  2 17:02:26 2009        (r914)
@@ -61,11 +61,11 @@
 
 usage() {
        echo ""
-       echo "`basename $0`: a handover testing script,"
+       echo "$(basename $0): a handover testing script,"
        echo "        designed for switching IP between two access points."
        echo "        This script must be executed with root privilege."
        echo ""
-       echo "Usage: `basename $0` [command] [options]"
+       echo "Usage: $(basename $0) [command] [options]"
        echo ""
        echo "[command] can be one of them:"
        echo " ifconfig: do ifconfig and iwconfig with static IP addresses 
(default)"
@@ -97,7 +97,7 @@
        exit 0
 fi
 
-if [ `whoami` != "root" ]; then
+if [ $(whoami) != "root" ]; then
        echo "You must be root to run this script!"
        exit 1
 fi
@@ -178,7 +178,7 @@
 done
 
 
-OLD_SSID=`iwgetid $IFWLAN |grep -i ESSID|sed "s/.*ESSID:\"\(.*\)\".*/\1/g"`
+OLD_SSID=$(iwgetid $IFWLAN | grep -i ESSID | sed "s/.*ESSID:\"\(.*\)\".*/\1/g")
 if [ "$OLD_SSID" = "$APSSID1" ]; then
        NEW_SSID="$APSSID2"
        NEW_IP="$MYIP2"

Modified: trunk/tools/switch-ip.owrtasus
==============================================================================
--- trunk/tools/switch-ip.owrtasus      Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/switch-ip.owrtasus      Wed Sep  2 17:02:26 2009        (r914)
@@ -61,11 +61,11 @@
 
 usage() {
        echo ""
-       echo "`basename $0`: a handover testing script,"
+       echo "$(basename $0): a handover testing script,"
        echo "        designed for switching IP between two access points."
        echo "        This script must be executed with root privilege."
        echo ""
-       echo "Usage: `basename $0` [command] [options]"
+       echo "Usage: $(basename $0) [command] [options]"
        echo ""
        echo "[command] can be one of them:"
        echo " ifconfig: do ifconfig and iwconfig with static IP addresses 
(default)"
@@ -97,7 +97,7 @@
        exit 0
 fi
 
-if [ `whoami` != "root" ]; then
+if [ $(whoami) != "root" ]; then
        echo "You must be root to run this script!"
        exit 1
 fi
@@ -178,7 +178,7 @@
 done
 
 
-OLD_SSID=`iwgetid $IFWLAN |grep -i ESSID|sed "s/.*ESSID:\"\(.*\)\".*/\1/g"`
+OLD_SSID=$(iwgetid $IFWLAN | grep -i ESSID | sed "s/.*ESSID:\"\(.*\)\".*/\1/g")
 if [ "$OLD_SSID" = "$APSSID1" ]; then
        NEW_SSID="$APSSID2"
        NEW_IP="$MYIP2"

Modified: trunk/tools/tunnel/seteth1address
==============================================================================
--- trunk/tools/tunnel/seteth1address   Wed Sep  2 16:35:26 2009        (r913)
+++ trunk/tools/tunnel/seteth1address   Wed Sep  2 17:02:26 2009        (r914)
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 
-echo Before del of eth1 `date +%s.%N`
+echo Before del of eth1 $(date +%s.%N)
 ifconfig eth1 del 2001:db8:100:f101::$1/64
-echo Before add of eth1 `date +%s.%N`
+echo Before add of eth1 $(date +%s.%N)
 ifconfig eth1 inet6 add 2001:db8:100:f101::$2/64
-echo After add of eth1 `date +%s.%N`
+echo After add of eth1 $(date +%s.%N)

Other related posts:

  • » [pisa-src] r914 - in trunk: auto-update/package/auto-update/files pairing pisacd pisasd test/packaging tools tools/convenience-scripts tools/tunnel - Diego Biurrun