[cig-commits] [commit] QA: Use POSIX syntax for shell scripts. (454b4b3)

cig_noreply at geodynamics.org cig_noreply at geodynamics.org
Mon Jan 20 11:49:40 PST 2014


Repository : ssh://geoshell/specfem2d

On branch  : QA
Link       : https://github.com/geodynamics/specfem2d/compare/28743f19b9f9fdb75d359c135053825c0ffd05b3...5e8aa55e68fd17b6f475fb65531b84195e497aa1

>---------------------------------------------------------------

commit 454b4b323270451e0f92aea53bbadb451c5a3f70
Author: Elliott Sales de Andrade <esalesde at physics.utoronto.ca>
Date:   Tue Jan 7 17:27:19 2014 -0500

    Use POSIX syntax for shell scripts.
    
    This should be more portable, but most scripts are really just a list of
    commands, making little difference. Tested with bash and dash (which is
    POSIX compliant, but doesn't implement most of bash's extensions).


>---------------------------------------------------------------

454b4b323270451e0f92aea53bbadb451c5a3f70
 UTILS/attenuation/build                            |   2 +-
 ...nvert_gif_to_avi.bash => convert_gif_to_avi.sh} |   2 +-
 ...unction.csh => convolve_source_timefunction.sh} |  10 +++++-----
 ...semble_all_movie_images_ImageMagick_montage.sh} |   2 +-
 UTILS/visualization/plot_wavefield.pl              |   8 ++++----
 doc/USER_MANUAL/manual_SPECFEM2D.pdf               | Bin 3672391 -> 3671686 bytes
 doc/USER_MANUAL/manual_SPECFEM2D.tex               |   4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/UTILS/attenuation/build b/UTILS/attenuation/build
index 459dfc8..bed467d 100755
--- a/UTILS/attenuation/build
+++ b/UTILS/attenuation/build
@@ -1,4 +1,4 @@
-#!/bin/csh
+#!/bin/sh
 
 # code to compute attenuation constants for SPECFEM2D
 
diff --git a/UTILS/convert_gif_to_avi.bash b/UTILS/convert_gif_to_avi.sh
similarity index 95%
rename from UTILS/convert_gif_to_avi.bash
rename to UTILS/convert_gif_to_avi.sh
index b2e246f..647a20d 100755
--- a/UTILS/convert_gif_to_avi.bash
+++ b/UTILS/convert_gif_to_avi.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 for file in imag*.gif; do
   jfile=`echo $file | sed 's/gif/jpg/'`
diff --git a/UTILS/convolve_source_timefunction.csh b/UTILS/convolve_source_timefunction.sh
similarity index 85%
rename from UTILS/convolve_source_timefunction.csh
rename to UTILS/convolve_source_timefunction.sh
index e543376..737bb5a 100755
--- a/UTILS/convolve_source_timefunction.csh
+++ b/UTILS/convolve_source_timefunction.sh
@@ -1,14 +1,14 @@
-#!/bin/csh
+#!/bin/sh
 
 # we mimic a triangle of half duration equal to half_duration_triangle
 # using a Gaussian having a very close shape, as explained in Figure 4.2
 # of the manual
 
-set half_duration_triangle = 11.2
+half_duration_triangle=11.2
 
-foreach file ( $* )
+for file in $*; do
 
-set nlines = `wc -l $file `
+nlines=`wc -l $file`
 echo $nlines > input_convolve_code.txt
 echo $half_duration_triangle >> input_convolve_code.txt
 # use .true. for a triangle and .false. for a Gaussian
@@ -21,5 +21,5 @@ echo convolving $file with half_duration_triangle = $half_duration_triangle usin
 
 rm input_convolve_code.txt
 
-end
+done
 
diff --git a/UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.csh b/UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.sh
similarity index 95%
rename from UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.csh
rename to UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.sh
index 769bfab..e4d7b61 100755
--- a/UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.csh
+++ b/UTILS/visualization/assemble_all_movie_images_ImageMagick_montage.sh
@@ -1,4 +1,4 @@
-#!/bin/csh
+#!/bin/sh
 
 rm movie_image*.jpg
 
diff --git a/UTILS/visualization/plot_wavefield.pl b/UTILS/visualization/plot_wavefield.pl
index b8af9b6..efd9570 100755
--- a/UTILS/visualization/plot_wavefield.pl
+++ b/UTILS/visualization/plot_wavefield.pl
@@ -175,9 +175,9 @@ $srcz = $srcz/1000;
 
 print "\nsource at ($srcx, $srcz)\n";
 
-$cshfile = "plot_wavefield.csh";
-open(CSH,">$cshfile");
-print "\nWriting CSH file $cshfile\n";
+$shfile = "plot_wavefield.sh";
+open(CSH,">$shfile");
+print "\nWriting CSH file $shfile\n";
 print CSH "gmtset BASEMAP_TYPE plain PAPER_MEDIA letter MEASURE_UNIT inch PLOT_DEGREE_FORMAT D TICK_LENGTH $tick LABEL_FONT_SIZE $fsize2 ANOT_FONT_SIZE $fsize2  HEADER_FONT $fontno ANOT_FONT $fontno LABEL_FONT $fontno HEADER_FONT_SIZE $fsize1 CHAR_ENCODING Standard+ COLOR_NAN $cgray\n";
 
 $R = "-R$xmin/$xmax/$zmin/$zmax";
@@ -622,7 +622,7 @@ print CSH "pstext $J -R0/1/0/1 -O -V >>$psfile<<EOF\n 10 10 $fsize0 0 $fontno CM
 print CSH "echo output psfile: $psfile\n";
 
 close (CSH);
-system("csh -f $cshfile");
+system("sh -f $shfile");
 system("gv $psfile &");
 
 #=================================================================
diff --git a/doc/USER_MANUAL/manual_SPECFEM2D.pdf b/doc/USER_MANUAL/manual_SPECFEM2D.pdf
index 2d32dc2..d0ab491 100644
Binary files a/doc/USER_MANUAL/manual_SPECFEM2D.pdf and b/doc/USER_MANUAL/manual_SPECFEM2D.pdf differ
diff --git a/doc/USER_MANUAL/manual_SPECFEM2D.tex b/doc/USER_MANUAL/manual_SPECFEM2D.tex
index 49c90a5..d9a3454 100644
--- a/doc/USER_MANUAL/manual_SPECFEM2D.tex
+++ b/doc/USER_MANUAL/manual_SPECFEM2D.tex
@@ -776,13 +776,13 @@ that the noise generated in the simulation by using a step source
 time function may be safely filtered out afterward based upon a convolution
 with the desired source time function and/or low-pass filtering. Use
 the serial code \texttt{convolve\_source\_timefunction.f90} and the
-script \texttt{convolve\_source\_timefunction.csh} for this purpose,
+script \texttt{convolve\_source\_timefunction.sh} for this purpose,
 or alternatively use signal-processing software packages such as SAC \urlwithparentheses{www.llnl.gov/sac}.
 Type
 \begin{lyxcode}
 make~convolve\_source\_timefunction
 \end{lyxcode}
-to compile the code and then set the parameter \texttt{hdur} in \texttt{convolve\_source\_timefunction.csh}
+to compile the code and then set the parameter \texttt{hdur} in \texttt{convolve\_source\_timefunction.sh}
 to the desired half-duration.
 %%
 \begin{figure}[htbp]



More information about the CIG-COMMITS mailing list