@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
cd ${0%*/*}
# get two strings of version numbers
# parse the two strings and compare
-function compare_versions() {
+compare_versions() {
cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[ ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
vb = "$2";
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
# get two strings of version numbers
# parse the two strings and compare
-function compare_versions() {
+compare_versions() {
cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[ ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
vb = "$2";
@@ -41,8 +41,8 @@ EOF
# We change dir since the later utilities assume to work in the project dir
cd ${0%*/*}
# remove previous
-\rm -rf autom4te.cache
-\rm -rf aclocal.m4
+rm -rf autom4te.cache
+rm -rf aclocal.m4
# make sure autoconf is up-to-date
ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'`
compare_versions 2.59 $ac_ver
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
# get two strings of version numbers
# parse the two strings and compare
-function compare_versions() {
+compare_versions() {
cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[ ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
vb = "$2";
@@ -40,8 +40,8 @@ EOF
# We change dir since the later utilities assume to work in the project dir
cd ${0%*/*}
# remove previous
-\rm -rf autom4te.cache
-\rm -rf aclocal.m4
+rm -rf autom4te.cache
+rm -rf aclocal.m4
# make sure autoconf is up-to-date
ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'`
compare_versions 2.59 $ac_ver
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
# get two strings of version numbers
# parse the two strings and compare
-function compare_versions() {
+compare_versions() {
cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[ ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
vb = "$2";
@@ -38,9 +38,9 @@ EOF
}
cd ${0%*/*}
-\rm -rf autom4te.cache
-\rm -rf aclocal.m4
-\rm -f config/missing config/install-sh config/depcomp config/mkinstalldirs config/ltmain.sh config/config.sub config/config.guess
+rm -rf autom4te.cache
+rm -rf aclocal.m4
+rm -f config/missing config/install-sh config/depcomp config/mkinstalldirs config/ltmain.sh config/config.sub config/config.guess
# make sure autoconf is up-to-date
ac_ver=`autoconf --version | head -n 1 | awk '{print $NF}'`
compare_versions 2.59 $ac_ver
@@ -1,8 +1,8 @@
-#!/bin/bash
+#!/bin/sh
# get two strings of version numbers
# parse the two strings and compare
-function compare_versions() {
+compare_versions() {
cat <<EOF > /tmp/$$.awk
/[0-9]+\.[0-9]+(\.[0-9]+)?[ ]+[0-9]+\.[0-9]+(\.[0-9]+)?/{
vb = "$2";
@@ -49,7 +49,7 @@ proc checker {simDir osmPath osmPortGuid} {
set osmTestCmd1 "$osmTestPath -v -t 1000 -g $osmPortGuid -l $osmTestLog -f c -i $osmTestInventory"
puts "-I- Invoking: $osmTestCmd1 ..."
# HACK: we currently ignore osmtest craches on exit flow:
- catch {set res [eval "exec $osmTestCmd1 >& $osmTestStdOutLog"]}
+ catch {set res [eval "exec $osmTestCmd1 > $osmTestStdOutLog 2>&1"]}
if {[catch {exec grep "OSMTEST: TEST \"Create Inventory\" PASS" $osmTestStdOutLog}]} {
puts "-E- osmtest Create Inventory failed"
@@ -62,7 +62,7 @@ proc checker {simDir osmPath osmPortGuid} {
set osmTestCmd2 "$osmTestPath -v -t 1000 -g $osmPortGuid -l $osmTestLog -f a -i $osmTestInventory"
puts "-I- Invoking: $osmTestCmd2 ..."
# HACK: we currently ignore osmtest craches on exit flow:
- catch {set res [eval "exec $osmTestCmd2 >& $osmTestStdOutLog"]}
+ catch {set res [eval "exec $osmTestCmd2 > $osmTestStdOutLog 2>&1"]}
if {[catch {exec grep "OSMTEST: TEST \"All Validations\" PASS" $osmTestStdOutLog}]} {
puts "-E- osmtest All Validations failed"
return 1
@@ -205,7 +205,7 @@ proc checker {simDir osmPath osmPortGuid} {
set cmd "ibdiagnet -v -r -t $topologyFile -o $simDir"
set ibdiagnetLog [file join $simDir ibdiagnet.stdout.log]
puts "-I- Invoking $cmd "
- if {[catch {set res [eval "exec $cmd >& $ibdiagnetLog"]} e]} {
+ if {[catch {set res [eval "exec $cmd > $ibdiagnetLog 2>&1"]} e]} {
puts "-E- ibdiagnet failed"
puts "-I- Result value $res"
puts "-I- Error: $e"
@@ -310,7 +310,7 @@ proc checker {simDir osmPath osmPortGuid} {
puts "-I- Invoking: $osmTestCmd1 ..."
# HACK: we currently ignore osmtest craches on exit flow:
- catch {set res [eval "exec $osmTestCmd1 >& $osmTestStdOutLog"]}
+ catch {set res [eval "exec $osmTestCmd1 > $osmTestStdOutLog 2>&1"]}
if {[catch {exec grep "OSMTEST: TEST \"Create Inventory\" PASS" $osmTestStdOutLog}]} {
puts "-E- osmtest Create Inventory failed"
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# fprogbar: File PROGress BAR
# This script output a progress bar in the terminal width which monitors
# file size relative to final expected size.
@@ -10,7 +10,7 @@
# Note: It is recommended to provide final size which is a bit less than
# expected size, since this size is the termination point
-function usage()
+usage()
{
echo "usage: fprogbar <filename> <final size in bytes> [<process ID to sync with>]"
exit 1
@@ -32,29 +32,29 @@ fi
# prepare progress bar of style [ ] to be [+++ ]
echo -n "[]"
-let num_of_dots=`tput cols`-12
-#for (( i= 0 ; i < $num_of_dots ; )) ; do echo -n -e '\267' ; let i++ ;done
+num_of_dots=`tput cols`-12
+#i=0; while [ $i -lt $num_of_dots ] ; do echo -n -e '\267' ; : $(( i += 1 )); done
#echo -n -e \]'\r'\[
-let bytes_per_dot=$final_sz/$num_of_dots
-let cur_bars=0
-let percent=0
+bytes_per_dot=$(( $final_sz / $num_of_dots ))
+cur_bars=0
+percent=0
# Update dots until final size is reached
-while ((1)); do
- lead_proc_cnt=`ps -eo "%p" | awk '$1 == '$pid2track' {print}' | wc -l`
+while : ; do
+ lead_proc_cnt=`ps -eo "%p" | awk '$1 == '$pid2track | wc -l`
current_sz=`ls -l $file | awk '{print $5}'`
- let req_bars=$current_sz/$bytes_per_dot
+ req_bars=$(( $current_sz / $bytes_per_dot ))
if [ $req_bars -ge $num_of_dots ]; then
- let req_bars=$num_of_dots
+ req_bars=$num_of_dots
fi
- for (( ; $cur_bars < $req_bars ; )); do
- let percent=($current_sz*100)/$final_sz
+ while [ $cur_bars -lt $req_bars ]; do
+ percent=$(( $(( $current_sz * 100 )) / $final_sz ))
printf "\b+] %3d%%\b\b\b\b\b" $percent
- let cur_bars++
+ : $(( cur_bars += 1 ))
done
# Check if reached expected file size
- if [ \( $cur_bars -eq $num_of_dots \) -o \( $percent -ge 100 \) ]; then
+ if [ $cur_bars -eq $num_of_dots -o $percent -ge 100 ]; then
echo " 100%"
exit 0
fi
@@ -65,5 +65,5 @@ while ((1)); do
exit 2
fi
- usleep 200000
+ sleep 0.2
done
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# This software is available to you under a choice of one of two
# licenses. You may choose to be licensed under the terms of the GNU
@@ -41,13 +41,13 @@ cd $PACKAGE_DIR
#
#Report: if config failed
-function config_failed() {
+config_failed() {
echo "Config failed ! (see $CFGLOG for details)"
exit 1
}
#Report: if make failed
-function make_failed() {
+make_failed() {
echo "Make failed ! (see $MAKELOG for details)"
exit 1
}
@@ -59,7 +59,7 @@ PREFIX=/usr
NO_BAR=0
# parse parameters
-while [ "$1" ]; do
+while [ $# -gt 0 ]; do
# echo "Current parsed param is : $1"
case $1 in
"--prefix")
@@ -1,7 +1,7 @@
-#!/bin/bash
+#!/bin/sh
usage="$0 -n node-name [-g sim-guids-file]"
-function help () {
+help() {
cat <<EOF
$usage
@@ -22,7 +22,7 @@ exit 0
guids_file=ibmgtsim.guids.txt
-while getopts ":n:gh" options; do
+while getopts "n:g:h" options; do
case $options in
n ) node_name=$OPTARG;;
g ) guids_file=$OPTARG;;
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# This software is available to you under a choice of one of two
# licenses. You may choose to be licensed under the terms of the GNU
@@ -19,22 +19,20 @@
# Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
#
-function cleanup_ibmgtsim_files() {
+cleanup_ibmgtsim_files() {
local PREFIX=$1
# Clean old distribution
binApps="IBMgtSim ibmsquit ibmssh mkSimNodeDir RunSimTest"
echo "Removing Executables from : .......... $PREFIX/bin."
for f in $binApps; do
- rm -f ${PREFIX}/bin/$f 2&>1 > /dev/null;
- if [ $? == 0 ]; then
+ if rm -f ${PREFIX}/bin/$f 2>&1 >/dev/null; then
echo " Removed : ${PREFIX}/bin/$f"
fi
done
echo "Removing Include Files from : ........ $PREFIX/include."
- rm -rf ${PREFIX}/include/ibmgtsim 2&>1 > /dev/null
- if [ $? == 0 ]; then
+ if rm -rf ${PREFIX}/include/ibmgtsim 2>&1 >/dev/null; then
echo " Removed : ${PREFIX}/include/ibmgtsim"
fi
@@ -42,8 +40,7 @@ function cleanup_ibmgtsim_files() {
libs="libibmscli.a libibmscli.la libibmscli.so libibmscli.so.1
libibmscli.so.1.0.0"
for f in $libs; do
- rm -rf ${PREFIX}/lib/$f 2&>1 > /dev/null;
- if [ $? == 0 ]; then
+ if rm -rf ${PREFIX}/lib/$f 2>&1 >/dev/null; then
echo " Removed : ${PREFIX}/lib/$f"
fi
done
@@ -52,7 +49,7 @@ function cleanup_ibmgtsim_files() {
NO_BAR=0
# parse parameters
-while [ "$1" ]; do
+while [ $# -gt 0 ]; do
# echo "Current parsed param is : $1"
case $1 in
"--prefix")