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

[MERGE] (master|issue14): make Seitosh less system specific

replace #!/bin/sh by #!/bin/bash
replace echo by printf

See comments to individual commits.
parents be15d4c6 c8d0e510
#!/bin/sh
#!/bin/bash
# this is <checkcopying>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <checkcopyright>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <checkgplphrase>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <checklibs.sh>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <checklinkedlibs>
# ----------------------------------------------------------------------------
#
......@@ -18,6 +18,6 @@ do
echo ${mf}:
grep ' -l' ${mf} | tr ' ' '\n' | egrep '^-l|PGP' \
| sed -e 's/-l//' | egrep -v \' | sort | uniq | tr '\n' ' '
echo -e '\n'
printf '\n\n'
done
# ----- END OF checklinkedlibs -----
#!/bin/sh
#!/bin/bash
# this is <depcheck.sh>
# ----------------------------------------------------------------------------
#
......@@ -36,7 +36,7 @@
#
dependency()
{
echo -n "${1}:"
printf "${1}:"
cpp -M $CPPFLAGS $1 | sed -e 's/\\$/ /' | tr '\n' ' '
echo
}
......
#!/bin/sh
#!/bin/bash
# this is <gplphrase>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <new>
# ----------------------------------------------------------------------------
#
......@@ -43,10 +43,11 @@
# 16/03/2014 V1.16 added perl
# 29/01/2015 V1.17 do not use subversion Id keyword - operate in git
# 04/10/2015 V1.18 add type stxt
# 26/10/2015 V1.19 add type bash
#
# ============================================================================
#
NEW_VERSION="NEW V1.18 all purpose bodyguard"
NEW_VERSION="NEW V1.19 all purpose bodyguard"
tmpfile=/tmp/new$$.tmp
......@@ -73,6 +74,7 @@ help()
echo " fmain: Fortran77 main program"
echo " f: Fortran77 source code"
echo " sh: Bourne-Shell script"
echo " bash: Bourne-Again-Shell script"
echo " awk: AWK script"
echo " txt: any text file"
echo " stxt: any text file; comment lines start with #"
......@@ -809,6 +811,23 @@ create_sh()
# END OF create_sh()
#
# ----------------------------------------------------------------------------
create_bash()
{
FILENAME=$1
PURPOSE=$(get_purpose)
create_bak $FILENAME
generic_shell_header $FILENAME "$PURPOSE" '#!/bin/bash'
catch_old $FILENAME
generic_shell_closing $FILENAME
fetch_tmp $FILENAME
chmod +x $FILENAME
}
#
# END OF create_bash()
#
# ----------------------------------------------------------------------------
create_python()
{
......@@ -964,6 +983,7 @@ do
fmain) create_fmain $FILENAME;;
f|fortran) create_f $FILENAME;;
sh) create_sh $FILENAME;;
bash) create_bash $FILENAME;;
awk) create_awk $FILENAME;;
txt) create_txt $FILENAME;;
stxt) create_stxt $FILENAME;;
......
#!/bin/sh
#!/bin/bash
# this is <systemtype.sh>
# ----------------------------------------------------------------------------
#
......@@ -11,23 +11,23 @@
#
# ============================================================================
#
echo -n "Date: "
printf "Date: "
LANG=C date 2>&1
echo -e -n "User: ${USER}; full name: "
printf "User: ${USER}; full name: "
egrep "^${USER}" /etc/passwd | cut -f 5 -d ':'
echo -e "\nHost and kernel:"
printf "\nHost and kernel:"
uname -a 2>&1
echo -e "\nOperating system:"
printf "\nOperating system:\n"
if ! type lsb_release &> /dev/null; \
then echo -e "The program lsb_release wasn't installed."; \
echo -e "No information provided."; \
then printf "The program lsb_release wasn't installed.\n"; \
printf "No information provided.\n"; \
fi
lsb_release -a 2>&1
echo -e "\nCompilers:"
(echo -n "${CC}: "; ${CC} --version) 2>&1 | head -1
(echo -n "${CXX}: "; ${CXX} --version) 2>&1 | head -1
(echo -n "${CPP}: "; ${CPP} --version) 2>&1 | head -1
(echo -n "${FC}: "; ${FC} --version) 2>&1 | head -1
(echo -n "doxygen: "; doxygen --version) 2>&1 | head -1
(echo -n "make: "; make --version) 2>&1 | head -1
printf "\nCompilers:\n"
(printf "${CC}: "; ${CC} --version) 2>&1 | head -1
(printf "${CXX}: "; ${CXX} --version) 2>&1 | head -1
(printf "${CPP}: "; ${CPP} --version) 2>&1 | head -1
(printf "${FC}: "; ${FC} --version) 2>&1 | head -1
(printf "doxygen: "; doxygen --version) 2>&1 | head -1
(printf "make: "; make --version) 2>&1 | head -1
# ----- END OF systemtype.sh -----
......@@ -147,7 +147,7 @@ hasgoal() {
# parameter $*: white-space separated list of directories
#
reportdirs() {
echo -e "\nDirectories:"
printf "\nDirectories:\n"
while test -n "$1"
do
echo " $1"
......@@ -169,7 +169,7 @@ reportdirs() {
makegoalindir() {
GOAL="$1"
DIR="$2"
echo -e "\nnext:\n directory: $DIR\n goal: $GOAL"
printf "\nnext:\n directory: $DIR\n goal: $GOAL\n"
if hasmake "$DIR"
then
if hasgoal "$GOAL" "$DIR"
......
#!/bin/sh
#!/bin/bash
# this is <DL1logger.sh>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <DL1sum.sh>
# ----------------------------------------------------------------------------
VERSION=2015-01-07
......@@ -140,7 +140,7 @@ do
for file in $FILES
do
FILE=$(echo $file | sed -e s,$BASEPATH,,)
echo -e "cus 0\nend" \
printf "cus 0\nend\n" \
| tidofi -o -cs -type thiesdl1:tr -Type bin $TMPFILE $file
export LANG=C
LINE=$(printf "%s: %5.1f %s\n" \
......
#!/bin/sh
#!/bin/bash
# this is <launchDL1logger.sh>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <ntpreport.sh>
# ----------------------------------------------------------------------------
#
......
#!/bin/sh
#!/bin/bash
# this is <extractmgmtar.sh>
# ----------------------------------------------------------------------------
#
......
......@@ -310,7 +310,7 @@ TESTS=$(patsubst %.c,%,$(CTESTS)) $(patsubst %.f,%,$(FTESTS)) \
$(patsubst %.cc,%,$(CXXTESTS))
testsexe: $(TESTS)
for d in $^; do /bin/echo -e "\n\nGO FOR $$d?"; read a; $$d; done
for d in $^; do printf "\n\nGO FOR $$d?\n"; read a; $$d; done
%.run: tests/%; $<; /bin/rm -fv $<
%.out: tests/%; ( $< 2>&1 ) > $@; /bin/rm -fv $<
......@@ -346,23 +346,23 @@ fortran.tmp: $(FCODE)
libtime.doc: README kernel.tmp fortran.tmp libtime.htmp timeutil.htmp \
libtime++.htmp $(ALLCODE)
cat README > $@
echo -e " \n \nDOCUMENTATION OF THE FORTRAN LIBRARAY KERNEL" \
printf " \n \nDOCUMENTATION OF THE FORTRAN LIBRARAY KERNEL" \
"\n============================================\n\n" >> $@
cat kernel.tmp >> $@
echo -e ' \n \nDOCUMENTATION OF THE FORTRAN SPECIFIC CODE' \
'\n==========================================\n' >> $@
printf ' \n \nDOCUMENTATION OF THE FORTRAN SPECIFIC CODE' \
'\n==========================================\n\n' >> $@
cat fortran.tmp >> $@
echo -e ' \n \nDOCUMENTATION OF THE C WRAPPER CODE' \
'\n===================================\n' >> $@
printf ' \n \nDOCUMENTATION OF THE C WRAPPER CODE' \
'\n===================================\n\n' >> $@
cat libtime.htmp >> $@
echo -e ' \n \nDOCUMENTATION OF THE TIMEUTIL C++ CLASSES' \
'\n=========================================\n' >> $@
printf ' \n \nDOCUMENTATION OF THE TIMEUTIL C++ CLASSES' \
'\n=========================================\n\n' >> $@
cat libtime++.htmp >> $@
echo -e ' \n \nDOCUMENTATION OF THE OLD TIMEUTIL C CODE' \
'\n========================================\n' >> $@
printf ' \n \nDOCUMENTATION OF THE OLD TIMEUTIL C CODE' \
'\n========================================\n\n' >> $@
cat timeutil.htmp >> $@
echo -e ' \n \nCVS REVISIONS' \
'\n=============\n' >> $@
printf ' \n \nCVS REVISIONS' \
'\n=============\n\n' >> $@
ident $(ALLFILES) | egrep '^ +\$$Id.+\$$' | cut -c 5- \
| sort | uniq | awk '{printf "%5s %25s %6s %12s %10s %8s %s\n", \
$$1, $$2, $$3, $$4, $$5, $$6, $$7;}' >> $@
......
#!/bin/sh
#!/bin/bash
# this is <stuploxx.sh>
# ----------------------------------------------------------------------------
# $Id$
......
......@@ -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 $<
......
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