Index: palm/trunk/SCRIPTS/mbuild
===================================================================
--- palm/trunk/SCRIPTS/mbuild	(revision 1469)
+++ palm/trunk/SCRIPTS/mbuild	(revision 1487)
@@ -1,3 +1,3 @@
-#!/bin/ksh
+#!/bin/bash
 
 # mbuild - script for compiling the PALM code and its utility programs
@@ -22,5 +22,6 @@
 # Current revisions:
 # ------------------
-# 
+# bash compatibility adjustments: output formatting with printf instead
+# of "typeset -L/-R", print replaced by echo
 # 
 # Former revisions:
@@ -117,9 +118,9 @@
  typeset -i  ih ihost=0
 
- typeset  -R30 calltime
- typeset  -L20 column1
- typeset  -L50 column2
- typeset  -L70 column3
- typeset  -L40 version="MBUILD  2.1  Rev$Rev$"
+ calltime=""
+ column1=""
+ column2=""
+ column3=""
+ version="MBUILD  2.1  Rev$Rev$"
 
     # ERROR HANDLING
@@ -174,5 +175,5 @@
     # DETERMINE THE LOCAL HOST
  local_host_real_name=$(hostname)
-# local_address=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
+ local_address=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{echo $2}')
 
 
@@ -357,21 +358,40 @@
  printf "\n"
  printf "#------------------------------------------------------------------------# \n"
- printf "| $version$calltime | \n"
+ printf "| %-40s%30s | \n" "$version" "$calltime"
  printf "|                                                                        | \n"
- column1="called on:"; column2=$local_host_real_name
- printf "| $column1$column2 | \n"
- column1="local username:"; column2=$local_username
- printf "| $column1$column2 | \n"
- column1="local IP-address:"; column2=$local_address
- printf "| $column1$column2 | \n"
- column1="config file:"; column2=$config_file
- printf "| $column1$column2 | \n"
- column1="makefile:"; column2=$makefile
- printf "| $column1$column2 | \n"
- column1="local source path:"; column2=$local_source_path
- printf "| $column1$column2 | \n"
+ printf "| %-20s%-50s | \n" "called on:" "$local_host_real_name"
+ printf "| %-20s%-50s | \n" "local username:" "$local_username"
+ printf "| %-20s%-50s | \n" "local IP-address:" "$local_address"
+ column2=$(echo $config_file | cut -c1-50 )
+ printf "| %-20s%-50s | \n" "config file:" "$column2"
+ line=$(echo "$config_file" | cut -c51-)
+ while [[ "$line" != "" ]]
+ do
+    column1=""
+    column2=$(echo $line | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "$column1" "$column2"
+    line=$(echo "$line" | cut -c51-)
+ done
+ column2=$(echo $makefile | cut -c1-50 )
+ printf "| %-20s%-50s | \n" "makefile:" "$column2"
+ line=$(echo "$makefile" | cut -c51-)
+ while [[ "$line" != "" ]]
+ do
+    column1=""
+    column2=$(echo $line | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "$column1" "$column2"
+    line=$(echo "$line" | cut -c51-)
+ done
+ column2=$(echo $local_source_path | cut -c1-50 )
+ printf "| %-20s%-50s | \n" "local source path:" "$column2"
+ line=$(echo "$local_source_path" | cut -c51-)
+ while [[ "$line" != "" ]]
+ do
+    column1=""
+    column2=$(echo $line | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "$column1" "$column2"
+    line=$(echo "$line" | cut -c51-)
+ done
  printf "#------------------------------------------------------------------------# \n"
-
-# printf "|                                                                        | \n"
 
 
@@ -943,83 +963,86 @@
     if [[ $remote_host = $local_host ]]
     then
-       column1="remote_host:"; column2="$remote_host (= local host!)"
+       column2="$remote_host (= local host!)"
     else
-       column1="remote_host:"; column2=$remote_host
-    fi
-    printf "| $column1$column2 | \n"
+       column2=$remote_host
+    fi
+    printf "| %-20s%-50s | \n" "remote_host:" "$column2"
     printf "|                                                                        | \n"
-    column1="conditions:"; column2="$condition1 $condition2"
-    printf "| $column1$column2 | \n"
-    column1="make depository:"; column2=$remote_md
-    printf "| $column1$column2 | \n"
+    printf "| %-20s%-50s | \n" "conditions:" "$condition1 $condition2"
+    column2=$(echo "$remote_md" | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "make depository:" "$column2"
     line=$(echo "$remote_md" | cut -c51-)
     while [[ "$line" != "" ]]
     do
        column1=""
-       column2=$line
-       printf "| $column1$column2 | \n"
+       column2=$(echo "$line" | cut -c1-50 )
+       printf "| %-20s%-50s | \n" "$column1" "$column2"
        line=$(echo "$line" | cut -c51-)
     done
     if [[ $compile_utility_programs = true ]]
     then
-       column1="utility directory:"; column2=$remote_ud
+       column2=$(echo "$remote_ud" | cut -c1-50 )
        printf "| $column1$column2 | \n"
-    fi
-    column1="username:"; column2=$remote_username
-    printf "| $column1$column2 | \n"
-    column1="address:"; column2=$remote_address
-    printf "| $column1$column2 | \n"
-    column1="compiler:"; column2=$compiler_name
-    printf "| $column1$column2 | \n"
+       printf "| %-20s%-50s | \n" "utility directory:" "$column2"
+       line=$(echo "$remote_ud" | cut -c51-)
+       while [[ "$line" != "" ]]
+       do
+          column1=""
+          column2=$(echo "$line" | cut -c1-50 )
+          printf "| %-20s%-50s | \n" "$column1" "$column2"
+          line=$(echo "$line" | cut -c51-)
+       done
+    fi
+    printf "| %-20s%-50s | \n" "username:" "$remote_username"
+    printf "| %-20s%-50s | \n" "address:" "$remote_address"
+    printf "| %-20s%-50s | \n" "compiler:" "$compiler_name"
     if [[ $compile_utility_programs = true ]]
     then
-       column1="serial compiler:"; column2=$compiler_name_ser
-       printf "| $column1$column2 | \n"
+       printf "| %-20s%-50s | \n" "serial compiler:" "$compiler_name_ser"
     fi
     if [[ "$make_options" != "" ]]
     then
-       column1="make options:"; column2=$make_options
-       printf "| $column1$column2 | \n"
-    fi
-    column1="cpp options:"; column2=$cpp_options
-    printf "| $column1$column2 | \n"
+       printf "| %-20s%-50s | \n" "make options:" "$make_options"
+    fi
+    column2=$(echo $cpp_options | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "cpp options:" "$column2"
     line=$(echo "$cpp_options" | cut -c51-)
     while [[ "$line" != "" ]]
     do
        column1=""
-       column2=$line
-       printf "| $column1$column2 | \n"
+       column2=$(echo $line | cut -c1-50 )
+       printf "| %-20s%-50s | \n" "$column1" "$column2"
        line=$(echo "$line" | cut -c51-)
     done
-    column1="compiler options:"; column2=$compiler_options
-    printf "| $column1$column2 | \n"
+    column2=$(echo $compiler_options | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "compiler options:" "$column2"
     line=$(echo "$compiler_options" | cut -c51-)
     while [[ "$line" != "" ]]
     do
        column1=""
-       column2=$line
-       printf "| $column1$column2 | \n"
+       column2=$(echo $line | cut -c1-50 )
+       printf "| %-20s%-50s | \n" "$column1" "$column2"
        line=$(echo "$line" | cut -c51-)
     done
-    column1="loader options:"; column2=$loader_options
-    printf "| $column1$column2 | \n"
+    column2=$(echo $loader_options | cut -c1-50 )
+    printf "| %-20s%-50s | \n" "loader options:" "$column2"
     line=$(echo "$loader_options" | cut -c51-)
     while [[ "$line" != "" ]]
     do
        column1=""
-       column2=$line
-       printf "| $column1$column2 | \n"
+       column2=$(echo $line | cut -c1-50 )
+       printf "| %-20s%-50s | \n" "$column1" "$column2"
        line=$(echo "$line" | cut -c51-)
     done
     if [[ $modules != "" ]]
     then
-       column1="modules to be load:"; column2=$modules
-       printf "| $column1$column2 | \n"
+       column2=$(echo $modules | cut -c1-50 )
+       printf "| %-20s%-50s | \n" "modules to be load:" "$column2"
        line=$(echo "$modules" | cut -c51-)
        while [[ "$line" != "" ]]
        do
           column1=""
-          column2=$line
-          printf "| $column1$column2 | \n"
+          column2=$(echo $line | cut -c1-50 )
+          printf "| %-20s%-50s | \n" "$column1" "$column2"
           line=$(echo "$line" | cut -c51-)
        done
@@ -1065,5 +1088,5 @@
           else
                 # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS
-             print "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"  |  ssh ${remote_username}@${remote_address}  2>&1
+             echo "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"  |  ssh ${remote_username}@${remote_address}  2>&1
           fi
 
@@ -1079,5 +1102,5 @@
           else
                 # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS
-             print  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"  |  ssh  ${remote_username}@${remote_address}  2>&1
+             echo "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"  |  ssh  ${remote_username}@${remote_address}  2>&1
           fi
 
@@ -1090,5 +1113,5 @@
           else
                 # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS
-             print  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"  |  ssh  ${remote_username}@${remote_address}  2>&1
+             echo  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"  |  ssh  ${remote_username}@${remote_address}  2>&1
           fi
 
@@ -1130,5 +1153,5 @@
           then
 
-             print "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
+             echo "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           elif [[ $remote_host = lctit ]]
@@ -1138,5 +1161,5 @@
              while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
              do
-                print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
+                echo "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
              done
 
@@ -1148,5 +1171,5 @@
           else
 
-             print "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
+             echo "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           fi
@@ -1184,5 +1207,5 @@
           else
                 # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS
-             print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  ${mainprog}  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_address}  2>&1
+             echo  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  ${mainprog}  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_address}  2>&1
           fi
 
@@ -1204,5 +1227,5 @@
           else
                 # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS
-             print "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]]  &&  (echo \"  *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p  ${remote_ud}/../SCRIPTS)"  |  ssh ${remote_username}@${remote_address}  2>&1
+             echo "[[ ! -d ${remote_ud} ]]  &&  (echo \"  *** ${remote_ud} will be created\"; mkdir -p  ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]]  &&  (echo \"  *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p  ${remote_ud}/../SCRIPTS)"  |  ssh ${remote_username}@${remote_address}  2>&1
           fi
 
@@ -1254,5 +1277,5 @@
           then
 
-             print "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address}
+             echo "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address}
 
           elif [[ $remote_host = lctit ]]
@@ -1262,5 +1285,5 @@
              while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
              do
-                print "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
+                echo "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
              done
 
@@ -1272,5 +1295,5 @@
           else
 
-             print "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
+             echo "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_address} 2>&1 | tee ${remote_host}_last_make_protokoll
 
           fi
