Commit c8d0e510 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[TASK] (issue14): replace echo by printf

Replace echo by printf at remaining locations, where echo is used with options
(as could be located by git grep). Seitosh should now be clean with respect to
shell usage.

Citation from the POSIX manual for printf as a motivation for this set of
changes:

RATIONALE
  The printf utility was added to provide functionality that has histori-
  cally been provided by echo. However, due to irreconcilable differences in
  the various versions of echo extant, the version has few special features,
  leaving those to this new printf utility, which is based on one in the Ninth
  Edition system.
parent 65921579
......@@ -40,8 +40,8 @@ COSINE=0.1
# produce a set of test signals
deco.tesiff.sff: ; tesiff $@
# produce a signal filter description
#deco.fil.xxx: ; echo -e "lpb 25.,2\ndel 30\nend" > $@
deco.fil.xxx: ; echo -e "lpb 25.,2\nend" > $@
#deco.fil.xxx: ; printf "lpb 25.,2\ndel 30\nend\n" > $@
deco.fil.xxx: ; printf "lpb 25.,2\nend\n" > $@
# filter test signals
deco.out.sff: deco.tesiff.sff deco.fil.xxx
stufi $(word 2,$^) -v -o $<; /bin/mv -fv $<.sfi $@
......
......@@ -34,47 +34,47 @@
sig.xxx.sff: ;siggen 6 $@ -Tm 0.2 -Te 1.
sigbox.xxx.sff: ;siggen 13 $@ -Ta .5 -T .2 -f 10. -d 0.012
tid.t.xxx.fil tid.s.xxx.fil: ; echo -e "DBG 0\ntid 270\nend" > $@
lpb.t.xxx.fil lpb.s.xxx.fil: ; echo -e "DBG 0\nlpb 0.05,5\nend" > $@
hpb.t.xxx.fil hpb.s.xxx.fil: ; echo -e "DBG 0\nhpb 0.05,5\nend" > $@
lp2.t.xxx.fil lp2.s.xxx.fil: ; echo -e "DBG 0\nlp2 0.2,0.707\nend" > $@
hp2.t.xxx.fil hp2.s.xxx.fil: ; echo -e "DBG 0\nhp2 0.2,0.707\nend" > $@
bp2.t.xxx.fil bp2.s.xxx.fil: ; echo -e "DBG 0\nbp2 0.2,0.707\nend" > $@
he2.t.xxx.fil he2.s.xxx.fil: ; echo -e "DBG 0\nhe2 0.2,0.707,1.,0.1\nend" > $@
le2.t.xxx.fil le2.s.xxx.fil: ; echo -e "DBG 0\nle2 0.2,0.707,.01,0.1\nend" > $@
he1.t.xxx.fil he1.s.xxx.fil: ; echo -e "DBG 0\nhe1 0.2,1.,0.1\nend" > $@
le1.t.xxx.fil le1.s.xxx.fil: ; echo -e "DBG 0\nle1 0.2,.01,0.1\nend" > $@
lp1.t.xxx.fil lp1.s.xxx.fil: ; echo -e "DBG 0\nlp1 0.2\nend" > $@
hp1.t.xxx.fil hp1.s.xxx.fil: ; echo -e "DBG 0\nhp1 0.2\nend" > $@
fac.t.xxx.fil fac.s.xxx.fil: ; echo -e "DBG 0\nfac -10.\nend" > $@
add.t.xxx.fil add.s.xxx.fil: ; echo -e "DBG 0\nadd -1.e2\nend" > $@
add1.t.xxx.fil add1.s.xxx.fil: ; echo -e "DBG 0\nadd -1.e-1\nend" > $@
add2.t.xxx.fil add2.s.xxx.fil: ; echo -e "DBG 0\nadd +1.e-1\nend" > $@
rev.t.xxx.fil rev.s.xxx.fil: ; echo -e "DBG 0\nrev 200\nend" > $@
tid.t.xxx.fil tid.s.xxx.fil: ; printf "DBG 0\ntid 270\nend\n" > $@
lpb.t.xxx.fil lpb.s.xxx.fil: ; printf "DBG 0\nlpb 0.05,5\nend\n" > $@
hpb.t.xxx.fil hpb.s.xxx.fil: ; printf "DBG 0\nhpb 0.05,5\nend\n" > $@
lp2.t.xxx.fil lp2.s.xxx.fil: ; printf "DBG 0\nlp2 0.2,0.707\nend\n" > $@
hp2.t.xxx.fil hp2.s.xxx.fil: ; printf "DBG 0\nhp2 0.2,0.707\nend\n" > $@
bp2.t.xxx.fil bp2.s.xxx.fil: ; printf "DBG 0\nbp2 0.2,0.707\nend\n" > $@
he2.t.xxx.fil he2.s.xxx.fil: ; printf "DBG 0\nhe2 0.2,0.707,1.,0.1\nend\n" > $@
le2.t.xxx.fil le2.s.xxx.fil: ; printf "DBG 0\nle2 0.2,0.707,.01,0.1\nend\n" > $@
he1.t.xxx.fil he1.s.xxx.fil: ; printf "DBG 0\nhe1 0.2,1.,0.1\nend\n" > $@
le1.t.xxx.fil le1.s.xxx.fil: ; printf "DBG 0\nle1 0.2,.01,0.1\nend\n" > $@
lp1.t.xxx.fil lp1.s.xxx.fil: ; printf "DBG 0\nlp1 0.2\nend\n" > $@
hp1.t.xxx.fil hp1.s.xxx.fil: ; printf "DBG 0\nhp1 0.2\nend\n" > $@
fac.t.xxx.fil fac.s.xxx.fil: ; printf "DBG 0\nfac -10.\nend\n" > $@
add.t.xxx.fil add.s.xxx.fil: ; printf "DBG 0\nadd -1.e2\nend\n" > $@
add1.t.xxx.fil add1.s.xxx.fil: ; printf "DBG 0\nadd -1.e-1\nend\n" > $@
add2.t.xxx.fil add2.s.xxx.fil: ; printf "DBG 0\nadd +1.e-1\nend\n" > $@
rev.t.xxx.fil rev.s.xxx.fil: ; printf "DBG 0\nrev 200\nend\n" > $@
# 0.2/(2*pi)=0.031830989
dif.t.xxx.fil dif.s.xxx.fil: ; echo -e "DBG 0\ndif 0.031830989\nend" > $@
del.t.xxx.fil del.s.xxx.fil: ; echo -e "DBG 1\ndel -0.05\nend" > $@
int.t.xxx.fil int.s.xxx.fil: ; echo -e "DBG 0\nint 0.031830989\nend" > $@
avg.t.xxx.fil avg.s.xxx.fil: ; echo -e "DBG 0\navg 30\nend" > $@
tre.t.xxx.fil tre.s.xxx.fil: ; echo -e "DBG 0\ntre 100\nend" > $@
han.t.xxx.fil: ; echo -e "DBG 0\nhan 0\nend" > $@
han.s.xxx.fil: ; echo -e "DBG 0\nsis 1,2000000\nend" > $@
first.t.xxx.fil: ; echo -e "DBG 0\nfirst 0\nend" > $@
first.s.xxx.fil: ; echo -e "DBG 0\navg 1\nend" > $@
fbl.t.xxx.fil: ; echo -e "DBG 0\nfbl 0,00,600\nend" > $@
fbl.s.xxx.fil: ; echo -e "DBG 0\nfbl 200,20,600\nend" > $@
dif.t.xxx.fil dif.s.xxx.fil: ; printf "DBG 0\ndif 0.031830989\nend\n" > $@
del.t.xxx.fil del.s.xxx.fil: ; printf "DBG 1\ndel -0.05\nend\n" > $@
int.t.xxx.fil int.s.xxx.fil: ; printf "DBG 0\nint 0.031830989\nend\n" > $@
avg.t.xxx.fil avg.s.xxx.fil: ; printf "DBG 0\navg 30\nend\n" > $@
tre.t.xxx.fil tre.s.xxx.fil: ; printf "DBG 0\ntre 100\nend\n" > $@
han.t.xxx.fil: ; printf "DBG 0\nhan 0\nend\n" > $@
han.s.xxx.fil: ; printf "DBG 0\nsis 1,2000000\nend\n" > $@
first.t.xxx.fil: ; printf "DBG 0\nfirst 0\nend\n" > $@
first.s.xxx.fil: ; printf "DBG 0\navg 1\nend\n" > $@
fbl.t.xxx.fil: ; printf "DBG 0\nfbl 0,00,600\nend\n" > $@
fbl.s.xxx.fil: ; printf "DBG 0\nfbl 200,20,600\nend\n" > $@
%.xxx.rules: Makefile
( echo "%.$(patsubst %.xxx.rules,%,$@).s.xxx.sff:" \
" %.xxx.sff $(patsubst %.xxx.rules,%,$@).s.xxx.fil"; \
echo -e '\tstufi $$(word 2,$$^) -v -o $$< ' \
'>$$(patsubst %.sff,%.out,$$@) 2>&1'; \
echo -e '\t/bin/mv -fv $$<.sfi $$@'; \
printf '\tstufi $$(word 2,$$^) -v -o $$< ' \
'>$$(patsubst %.sff,%.out,$$@) 2>&1\n'; \
printf '\t/bin/mv -fv $$<.sfi $$@\n'; \
echo "%.$(patsubst %.xxx.rules,%,$@).t.xxx.sff:" \
" %.xxx.sff $(patsubst %.xxx.rules,%,$@).t.xxx.fil"; \
echo -e '\ttidofi -cf $$(word 2,$$^)' \
printf '\ttidofi -cf $$(word 2,$$^)' \
'-v -o $$@ $$< ' \
'| tee $$(patsubst %.sff,%.out,$$@) 2>&1'; \
'| tee $$(patsubst %.sff,%.out,$$@) 2>&1\n'; \
echo "%.$(patsubst %.xxx.rules,%,$@).t.xxx.fil:" \
" $(patsubst %.xxx.rules,%,$@).t.xxx.fil" \
'; /bin/ln -sfv $$< $$@'; \
......
......@@ -53,7 +53,7 @@ NOISEDEBUG=
# NOISEOPT: additional options to be passed to foutra
#
noise.xxx.fnycalc:
echo -e "0.5\n$(NOISEDT)\n/\np" > $@
printf "0.5\n$(NOISEDT)\n/\np\n" > $@
noise.xxx.fny: noise.xxx.fnycalc
dc --file=$< > $@
noise.xxx.ascii:
......@@ -74,11 +74,11 @@ noise.xxx.gpt: noise.xxx.001.asc noise.xxx.fny
echo "power=$(NOISERMS)**2" >> $@
echo "fNy=0.5/$(NOISEDT)" >> $@
echo "PSD=power/fNy" >> $@
echo -n "set title '$(shell cat noise.xxx.rms) counts; " >> $@
printf "set title '$(shell cat noise.xxx.rms) counts; " >> $@
echo "f_{Nyquist}=$(shell cat $(word 2,$^)) Hz'" >> $@
echo "set xlabel 'frequency / Hz'" >> $@
echo "set ylabel 'PSD / counts^{2} Hz^{-1}'" >> $@
echo -n "plot '$<' t 'PSD calculated by foutra' w l," >> $@
printf "plot '$<' t 'PSD calculated by foutra' w l," >> $@
echo "PSD t 'expected PSD'" >> $@
noise.xxx.ps: noise.xxx.gpt
gnuplot $<
......
......@@ -88,7 +88,7 @@ seismo.TZ seismo.TR: refmetmain.xxx
# produce seismogram file by windowing such that backpropagating
# cut-off phase is removed
WINLIM=2000
win.fil.xxx: ; echo -e "win 1,$(WINLIM)\nend" > $@
win.fil.xxx: ; printf "win 1,$(WINLIM)\nend\n" > $@
newsynthetic%.sff: %.TZ win.fil.xxx
stufi $(word 2,$^) -v -o $<; /bin/mv $<.sfi $@
......@@ -100,7 +100,7 @@ synthetic2lay.sff synthetic2layb.sff syntheticseismo.sff:
# apply a filter, simulating a source time function
STFPER=0.04
STFFAC=0.1
stf.fil.xxx: ; echo -e "lpb $(STFPER),4\ndel 0.03\nfac $(STFFAC)\nend" > $@
stf.fil.xxx: ; printf "lpb $(STFPER),4\ndel 0.03\nfac $(STFFAC)\nend\n" > $@
data%.sff: synthetic%.sff stf.fil.xxx
tidofi -v -o -cf $(word 2,$^) $@ $<
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment