Greetings,
I have to run an script that repeats a set of operations, for this reason, I created a script function, but I´m getting the following error message:
Code:
[munoz@comet2 ~/test]$ sh -x tst_script
'st_script: line 5: syntax error near unexpected token `
'st_script: line 5: `invscatexperiment()
The script is as follows:
Code:
#!/bin/sh
# Script que realiza una prueba completa del algoritmo final
# Prueba los elementos que se conocen trabajan correctamente sin
# mutaciones y aquellos que requieren mutaciones
invscatexperiment() {
cp $1 geoinp.txt
for (( n = 1; n <= 20; n++ )); do
/opt/mpich-ch_p4-gcc-1.2.7/bin/mpirun -np 60 -nolocal -machinefile mlist ~/a1.out
cp bestChromo.m best_$2_pso_$n.m
cp evMov.m move_$2_pso_$n.m
cp stat.txt stat_$2_pso_$n.txt
cp scat.txt scat_$2_pso_$n.txt
~/kill_script
/opt/mpich-ch_p4-gcc-1.2.7/bin/mpirun -np 60 -nolocal -machinefile mlist ~/a2.out
cp bestChromo.m best_$2_bpso_$n.m
cp evMov.m move_$2_bpso_$n.m
cp stat.txt stat_$2_bpso_$n.txt
cp scat.txt scat_$2_bpso_$n.txt
~/kill_script
done
return
}
cp gainvscat1.txt gainvscat.txt
invscatexperiment geoinpRECTdiel.txt RECT
invscatexperiment geoinpGARBAGE.txt GARBAGE
invscatexperiment geoinpBT.txt BT
invscatexperiment geoinpCONVRECT.txt CONVRECT
invscatexperiment geoinpPACMAN.txt PACMAN
cp gainvscat2.txt gainvscat.txt
invscatexperiment geoinpCIRC.txt CIRC
invscatexperiment geoinpL.txt L
invscatexperiment geoinp2SQ.txt 2SQ
I´m using a Linux machine to run the script, but I have to remote access it. I use a Win machine to edit the code, so this script was made in wordpad :S.
I appreciate any help that you could provide me.
Thanks