Using \n in csh

I am trying to use \n for a new line in csh like this

echo "some text\n"
echo "some more text\n"

but am getting

some text\n
some more text\n

I see following:

 
%echo "abc\n"
abc
 
%

This did not work.

if ($opt_npop == 1) echo " -npop = $npop\n"

Working for me:

 
#!/usr/bin/csh
echo "Hi\n";
set opt=1;
set op1="abcdef";
echo $opt
if($opt == 1) echo "-nopt=$opt\n";

Result:

Hi
 
1
-nopt=abcdef
 
%

Show more code please..

What it is not work?
There is not seem any error

  set ierr = 0
  set iarg = 0
  set opt_tpath = 0
  set opt_fbase = 0
  set opt_fdata = 0
  set opt_fstmod = 0
  set opt_frestore = 0
  set opt_ftag = 0
  set opt_tee = 0
  set opt_nxz = 0
  set opt_npop = 0
  set opt_varp = 0
  set opt_sigma = 0
  set opt_maxiter = 0
  set opt_dtau = 0
  set opt_mdacc = 0
  set opt_mindist = 0
  set opt_maxitertp = 0
  set opt_vrb = 0
  set opt_usage = 0
  set opt_example = 0
  set opt_help = 0
  set opt_redirect = 0

  set nlay = 1
  set param = "P"
  set intp = "LIN"
  set std = "on"
  set frestore = ""
  set ftag = ""
  set Avrb = ""
  set tol = 0.0

  set Version = "V03"
  alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`'
  set narg = $#argv
  while ($iarg < $narg)

    MATH iarg = $iarg + 1
    set arg = $argv[$iarg]
    set opt = `echo $arg | awk 'BEGIN {FS="="} {print $1}'`
    set par = `echo $arg | awk 'BEGIN {FS="="} {print $2}'`

    switch ($opt)
    case "-tpath":
        set Atpath = $par
        set tpath = $Atpath
        set opt_tpath = 1
        breaksw
    case "-fbase":
        set Afbase = $par
        set fbase = `echo $Afbase | awk 'BEGIN {FS=".base"} {print $1}'`
        set opt_fbase = 1
        breaksw
    case "-fdata":
        set Adata = $par
        set fdata = `echo $Afdata | awk 'BEGIN {FS=".dat"} {print $1}'`
        set opt_fdata = 1
        breaksw
    case "-fstmod":
        set Afstmod = $par
        set fstmod = `echo $Afstmod | awk 'BEGIN {FS=".cmod"} {print $1}'`
        set opt_fstmod = 1
        breaksw
    case "-frestore":
        set Afrestore = $par
        set frestore = $Afrestore
        set opt_frestore = 1
        breaksw
    case "-ftag":
        set Aftag = $par
        set ftag = $Aftag
        set opt_ftag = 1
        breaksw
    case "-nxz":
        set Anxz = $par
        set nxz = $Anxz
        set nxp = `echo $Anxz | awk 'BEGIN {FS="x"} {print $1}'`
        set nzp = `echo $Anxz | awk 'BEGIN {FS="x"} {print $2}'`
        set opt_nxz = 1
        breaksw
    case "-npop":
        set Anpop = $par
        set npop = $Anpop
        set opt_npop = 1
        breaksw
    case "-varp":
        set Avarp = $par
        set varp = $Avarp
        set varpint = `echo $Avarp | awk 'BEGIN {FS="."} {print $1}'`
        set varpfrc = `echo $Avarp | awk 'BEGIN {FS="."} {print $2}'`
        set opt_varp = 1
        breaksw
    case "-sigma":
        set Asigma = $par
        set sigma0 = $Asigma
        set opt_sigma = 1
        breaksw
    case "-maxiter":
        set Amaxiter = $par
        set maxiter = $Amaxiter
        set opt_maxiter = 1
        breaksw
    case "-dtau":
        set Adtau = $par
        set dtau = $Adtau
        set opt_dtau = 1
        breaksw
    case "-mdacc":
        set Amdacc = $par
        set mdacc = $Amdacc
        set opt_mdacc = 1
        breaksw
    case "-mindist":
        set Amindist = $par
        set mindist = $Amindist
        set opt_mindist = 1
        breaksw
    case "-maxitertp":
        set Amaxitertp = $par
        set maxitertp = $Amaxitertp
        set opt_maxitertp = 1
        breaksw
    case "-vrb":
        set Avrb = $par
        set vrb = $Avrb
        set opt_vrb = 1
        breaksw
    case "-redirect":
        set Aredirect = $par
        set opt_redirect = 1
        breaksw
    default:
        set Aerr = $arg
        set ierr = 1
        breaksw
    endsw

  end   # while

  set arg1 = "../Scripts/tdarwin.csh"
  set arg2 = "[-tpath=] [-fbase=fbase.base] [-fdata=fdata.dat]"
  set arg3 = "[-fstmod=fstmod.cmod] [-frestore=restore.back] [-ftag=]"
  set arg4 = "-nxz= -npop= -varp= [-sigma=] [-maxiter=]"
  set arg5 = "[-dtau=] [-mdacc=] [-mindist=] [-maxitertp=]"
  set usage1 = "$arg1 $arg2 $arg3 $arg4 $arg5"
  set eg1 = "-fdata=npt06-z30-sr65.dat -fstmod=npt06-z30-sr65-4x3smp.cmod"
  set eg2 = "-nxz=8x6 -npop=480 -varp=0.25"
  set eg1 = "$arg1 $eg1 $eg2"

  if ($opt_tpath == 0) then
    set tpath = "/nethome/chrisd/GStat/Trunk/TommyCD/bin"
  endif

  if ($opt_fbase == 0) then

      set NF = `ls -lrt *.base  \
                | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                | awk '{print NF}'`

      if ($NF > 1) then
        set msg = "ABORT: Multiple base files exist in directory"
        echo ""
        echo "ERROR: "$NF" base files exist"
        echo "       "$msg
        echo ""
        echo "        Set the base file using the -Base option"
        echo ""
        echo "End"
        echo ""
        exit 1
      endif

      set fbase = `ls -lrt *.base  \
                   | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                   | awk '{print $1}'`

      set fbase = `echo $fbase | awk 'BEGIN { FS=".base" } { print $1 }'`

  endif

  if ($opt_fdata == 0) then

      set NF = `ls -lrt *.dat  \
                | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                | awk '{print NF}'`

      if ($NF > 1) then
        set msg = "ABORT: Multiple data files exist in directory"
        echo ""
        echo "ERROR: "$NF" data files exist"
        echo "       "$msg
        echo ""
        echo "        Set the data file using the -Data option"
        echo ""
        exit 1
      endif

      set fdata = `ls -lrt *.dat  \
                   | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                   | awk '{print $1}'`

      set fdata = `echo $fdata | awk 'BEGIN { FS=".dat" } { print $1 }'`

  endif

  if ($opt_tpath == 1) echo " -tpath = $tpath\n"

  if ($opt_fbase == 1) echo " -fbase = fbase.base = $fbase\n"

  if ($opt_fdata == 1) echo " -fdata = fdata.dat = $fdata\n"

  if ($opt_fstmod == 1) echo " -fstmod = fstmod.cmod = $fstmod\n"

  if ($opt_frestore == 1) echo " -frestore = frestore.back = $frestore\n"

  if ($opt_ftag == 1) echo " -ftag = $ftag\n"

  if ($opt_nxz == 1) echo " -nxz = $Anxz\n"

  if ($opt_npop == 1) echo " -npop = $npop\n"

  if ($opt_varp == 1) echo " -varp = $varp\n"

  if ($opt_sigma == 1) echo " -sigma = $sigma\n"

  if ($opt_maxiter == 1) echo " -maxiter = $maxiter\n"

  if ($opt_dtau == 1) echo " -dtau = $dtau\n"

  if ($opt_mdacc == 1) echo " -mdacc = $mdacc\n"

  if ($opt_mindist == 1) echo " -mindist = $mindist\n"

  if ($opt_maxitertp == 1) echo " -maxitertp = $maxitertp\n"

  if ($opt_vrb == 1) echo " -vrb = $vrb\n"

  if ($opt_redirect == 1) echo " -redirect\n"

---------- Post updated at 02:13 PM ---------- Previous update was at 02:11 PM ----------

Am getting like this

 -fstmod = fstmod.cmod = npt10-z30-sr65-rgdt0p25-dc0p25-4x3smp\n
 -nxz = 8x6\n
 -npop = 480\n
 -varp = 0.20\n

I know it's strange. Got no clue what's happening. :confused:

is that full code or portion of your script?
and which command you use so what is your full command with positional parameters ?

A longer portion until I echo the arguments.

Full command is

../../../Scripts/tdarwin.csh -fstmod=npt10-z30-sr65-rgdt1p00-dc0p25-4x3smp.cmod -nxz=8x6 -npop=480 -varp=0.25

---------- Post updated at 03:00 PM ---------- Previous update was at 02:58 PM ----------

This is the full scipt

#!/bin/csh

#$$$$$---------------------------------------------------------------
#
# Script: tdarwin.csh
#
# Version: V04
#
# Purpose: Runs Tommy tdarwin genetic algorithm.
#
# Usage:
#
#  ../Scripts/tdarwin.csh [-fbase=fbase.base] [-fdata=fdata.dat]
#     -fstmod=fstmod.cmod -nxz= -varp= -sigma= [-tpf] [-usage] [-help]
#
#  The -n option tells echo not to print a newline after the message.
#  echo -n " -dtau = $Adtau"
#
# Where:
#
#  (I)  tpath    Path to tommy tdarwin program
#  (I)  fbase    File defining the model
#  (I)  fdata    File containing travel times
#  (I)  fstmod   File containing a starting sound speed model
#  (I)  ftag     Appends a name tag in the output files
#  (I)  nxz      Model size to estimate. (E.g. 3x2)
#  (I)  npop     Size of the population
#  (I)  varp     Sound speed variation around starting model
#  (I)  sigma    Sound speed variation around starting model
#  (I) -usage    Shows the arguments to this script
#  (I) -help     Shows a description of the script
#
# Examples:
#
#  ../Scripts/tdarwin.csh data=npt06-z30-sr65.dat
#     fstmod=jcdint-z30.cmod nxz=3x2 varp=2.5 -tpf
#
# History:
#
#  V01 - DEC 2009 - Christopher Dimech
#       Initial release.
#  V02 - JAN 2010 - Christopher Dimech
#        Scripts accepts various arguments.
#  V03 - MAY 2010 - Christopher Dimech
#        Included new argument handling mechanism.
#  V04 - AUG 2010 - Christopher Dimech
#        Introduced the -restore option.
#
#$$$$$---------------------------------------------------------------

#/nethome/chrisd/Zollo/RISSC/Tommy/bin/tdarwin base=jcd40Mm.base data=jcd40Mm.dat outmod=jcd40Mm3x2.dmod nxp="3" nzp="2" param="P" intp="LIN" std=on nlay=1 dtau=0.1 mindist=0.5 mdacc=0.5 varp=2.0 sigma0=1e4 maxiter=200 maxitertp=10 tol=0.0 npop=60 backup=jcd40Mm3x2.bck expl=jcd40Mm3x2.exp vrb=medium 2>&1 | tee jcd40Mm3x2.log

# -------------------------------------------------------------------
# Set local variables from the command line argument list
# -------------------------------------------------------------------

  set ierr = 0
  set iarg = 0
  set opt_tpath = 0
  set opt_fbase = 0
  set opt_fdata = 0
  set opt_fstmod = 0
  set opt_frestore = 0
  set opt_ftag = 0
  set opt_tee = 0
  set opt_nxz = 0
  set opt_npop = 0
  set opt_varp = 0
  set opt_sigma = 0
  set opt_maxiter = 0
  set opt_dtau = 0
  set opt_mdacc = 0
  set opt_mindist = 0
  set opt_maxitertp = 0
  set opt_vrb = 0
  set opt_usage = 0
  set opt_example = 0
  set opt_help = 0
  set opt_redirect = 0

  set nlay = 1
  set param = "P"
  set intp = "LIN"
  set std = "on"
  set frestore = ""
  set ftag = ""
  set Avrb = ""
  set tol = 0.0

  set Version = "V03"
  alias MATH 'set \!:1 = `echo "\!:3-$" | bc -l`'
  set narg = $#argv
  while ($iarg < $narg)

    MATH iarg = $iarg + 1
    set arg = $argv[$iarg]
    set opt = `echo $arg | awk 'BEGIN {FS="="} {print $1}'`
    set par = `echo $arg | awk 'BEGIN {FS="="} {print $2}'`

    switch ($opt)
    case "-tpath":
        set Atpath = $par
        set tpath = $Atpath
        set opt_tpath = 1
        breaksw
    case "-fbase":
        set Afbase = $par
        set fbase = `echo $Afbase | awk 'BEGIN {FS=".base"} {print $1}'`
        set opt_fbase = 1
        breaksw
    case "-fdata":
        set Adata = $par
        set fdata = `echo $Afdata | awk 'BEGIN {FS=".dat"} {print $1}'`
        set opt_fdata = 1
        breaksw
    case "-fstmod":
        set Afstmod = $par
        set fstmod = `echo $Afstmod | awk 'BEGIN {FS=".cmod"} {print $1}'`
        set opt_fstmod = 1
        breaksw
    case "-frestore":
        set Afrestore = $par
        set frestore = $Afrestore
        set opt_frestore = 1
        breaksw
    case "-ftag":
        set Aftag = $par
        set ftag = $Aftag
        set opt_ftag = 1
        breaksw
    case "-nxz":
        set Anxz = $par
        set nxz = $Anxz
        set nxp = `echo $Anxz | awk 'BEGIN {FS="x"} {print $1}'`
        set nzp = `echo $Anxz | awk 'BEGIN {FS="x"} {print $2}'`
        set opt_nxz = 1
        breaksw
    case "-npop":
        set Anpop = $par
        set npop = $Anpop
        set opt_npop = 1
        breaksw
    case "-varp":
        set Avarp = $par
        set varp = $Avarp
        set varpint = `echo $Avarp | awk 'BEGIN {FS="."} {print $1}'`
        set varpfrc = `echo $Avarp | awk 'BEGIN {FS="."} {print $2}'`
        set opt_varp = 1
        breaksw
    case "-sigma":
        set Asigma = $par
        set sigma0 = $Asigma
        set opt_sigma = 1
        breaksw
    case "-maxiter":
        set Amaxiter = $par
        set maxiter = $Amaxiter
        set opt_maxiter = 1
        breaksw
    case "-dtau":
        set Adtau = $par
        set dtau = $Adtau
        set opt_dtau = 1
        breaksw
    case "-mdacc":
        set Amdacc = $par
        set mdacc = $Amdacc
        set opt_mdacc = 1
        breaksw
    case "-mindist":
        set Amindist = $par
        set mindist = $Amindist
        set opt_mindist = 1
        breaksw
    case "-maxitertp":
        set Amaxitertp = $par
        set maxitertp = $Amaxitertp
        set opt_maxitertp = 1
        breaksw
    case "-vrb":
        set Avrb = $par
        set vrb = $Avrb
        set opt_vrb = 1
        breaksw
    case "-redirect":
        set Aredirect = $par
        set opt_redirect = 1
        breaksw
    case "-usage":
        set opt_usage = 1
        breaksw
    case "-example":
        set opt_example = 1
        breaksw
    case "-help":
        set opt_help = 1
        breaksw
    default:
        set Aerr = $arg
        set ierr = 1
        breaksw
    endsw

  end   # while

# -------------------------------------------------------------------
# Information about this script
# -------------------------------------------------------------------

  set arg1 = "../Scripts/tdarwin.csh"
  set arg2 = "[-tpath=] [-fbase=fbase.base] [-fdata=fdata.dat]"
  set arg3 = "[-fstmod=fstmod.cmod] [-frestore=restore.back] [-ftag=]"
  set arg4 = "-nxz= -npop= -varp= [-sigma=] [-maxiter=]"
  set arg5 = "[-dtau=] [-mdacc=] [-mindist=] [-maxitertp=]"
  set usage1 = "$arg1 $arg2 $arg3 $arg4 $arg5"
  set eg1 = "-fdata=npt06-z30-sr65.dat -fstmod=npt06-z30-sr65-4x3smp.cmod"
  set eg2 = "-nxz=8x6 -npop=480 -varp=0.25"
  set eg1 = "$arg1 $eg1 $eg2"

  if ($opt_usage == 1) then
    echo "\n $usage1\n"
    exit 0
  endif

  if ($opt_example == 1) then
    echo "\n $eg1\n"
    exit 0
  endif

  if ($opt_usage == 0) then
    echo ""
    echo "-------------------------------------------------------------"
    echo ""
    echo "SCRIPT: ../Scripts/tdarwin.csh"
    echo ""
    echo "VERSION: "$Version
    echo ""
    echo "CREATED BY: CHRISTOPHER DIMECH"
    echo ""
    echo "PURPOSE: Runs Tommy tdarwin genetic algorithm"
    echo ""
  endif

  if (($opt_help == 1) || ($narg == 0)) then
    echo ""
    echo "USAGE:"
    echo ""
    echo "   $usage"
    echo ""
    echo "WHERE:"
    echo ""
    echo "   (O)  fout.cmod     Sound speed model"
    echo "   (O)  fout.tpf      Tommy parameter file"
    echo "   (O)  fout.log      Log file for the tdarwin run"
    echo "   (O)  fout.expl     Exploration file"
    echo "   (O)  fout.back     Backup file"
    echo "   (I)  tpath         Path to TOMMY tdarwin"
    echo "   (I)  fbase.base    Base file to use"
    echo "   (I)  fdata.dat     Travel time data file"
    echo "   (I)  fstmod.cmod   Starting sound speed model"
    echo "   (I)  frestore      Restore population from a backup file, .back"
    echo "   (I)  fout          Name for the output files created by tdarwin"
    echo "   (I)  nxz           Model size for output, e.g. 4x3"
    echo "   (I)  npop          Population Size"
    echo "   (I)  varp          Sound speed variation around starting model"
    echo "   (I)  sigma         "
    echo "   (I)  vrb           Level of verbosity in tdarwin log file"
    echo "                      vrb = (none/low/medium/high)"
    echo "   (I) -usage         Help on using the script"
    echo "   (I) -example       Help on using the script"
    echo "   (I) -help          Help on using the script"
    echo ""
    echo "EXAMPLES:"
    echo ""
    echo "   $eg1"
    echo ""
    echo "-----------------------------------------------------------"
    echo ""
    exit 0
  endif

# -------------------------------------------------------------------
# Check and display any errors that might occur
# -------------------------------------------------------------------

  if ($ierr == 1) then
    echo "\nERROR: Unrecognised argument, $Aerr\n"
    exit 1
  endif

  if ($opt_npop == 0) then
    echo "\nERROR: No npop not set"
    echo "       Set npop using the -npop option\n"
    exit 1
  endif

  if (($opt_fstmod == 1) && ($opt_frestore == 1)) then
    set msg = "Can't set both -fstmod and -frestore"
    echo "\nERROR: "$msg
    echo "        Set either -fstmod or -frestore\n"
    exit 1
  endif

  if (($opt_frestore == 1) && ($opt_ftag == 0)) then
    echo "\nERROR: The -frestore option requires the -ftag option"
    echo "        Set ftag using the -ftag option\n"
    exit 1
  endif

# -------------------------------------------------------------------
# Set default values
# -------------------------------------------------------------------

# -------------------------------------------------------------------
  if ($opt_tpath == 0) then
    set tpath = "/nethome/chrisd/GStat/Trunk/TommyCD/bin"
  endif

# -------------------------------------------------------------------
# Look in the current directory and find the base file
  if ($opt_fbase == 0) then

      set NF = `ls -lrt *.base  \
                | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                | awk '{print NF}'`

      if ($NF > 1) then
        set msg = "ABORT: Multiple base files exist in directory"
        echo ""
        echo "ERROR: "$NF" base files exist"
        echo "       "$msg
        echo ""
        echo "        Set the base file using the -Base option"
        echo ""
        echo "End"
        echo ""
        exit 1
      endif

      set fbase = `ls -lrt *.base  \
                   | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                   | awk '{print $1}'`

      set fbase = `echo $fbase | awk 'BEGIN { FS=".base" } { print $1 }'`

  endif

# -------------------------------------------------------------------
# Look in the current directory and find the data file
  if ($opt_fdata == 0) then

      set NF = `ls -lrt *.dat  \
                | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                | awk '{print NF}'`

      if ($NF > 1) then
        set msg = "ABORT: Multiple data files exist in directory"
        echo ""
        echo "ERROR: "$NF" data files exist"
        echo "       "$msg
        echo ""
        echo "        Set the data file using the -Data option"
        echo ""
        exit 1
      endif

      set fdata = `ls -lrt *.dat  \
                   | awk ' BEGIN{ORS=" "}; {print $NF} '  \
                   | awk '{print $1}'`

      set fdata = `echo $fdata | awk 'BEGIN { FS=".dat" } { print $1 }'`

  endif

# -------------------------------------------------------------------
  if ($opt_sigma == 0) set sigma = 1.0

# -------------------------------------------------------------------
  if ($opt_maxiter == 0) set maxiter = 500

# -------------------------------------------------------------------
  if ($opt_dtau == 0) set dtau = 0.03

# -------------------------------------------------------------------
  if ($opt_mdacc == 0) set mdacc = 0.3

# -------------------------------------------------------------------
  if ($opt_mindist == 0) set mindist = 0.05

# -------------------------------------------------------------------
  if ($opt_maxitertp == 0) set maxitertp = 25

# -------------------------------------------------------------------
  if ($opt_vrb == 0) set vrb = "medium"

# -------------------------------------------------------------------
# Command line arguments
# -------------------------------------------------------------------

  echo ""
  echo "COMMAND LINE ARGUMENTS:"
  echo ""

  if ($opt_tpath == 1) echo " -tpath = $tpath\n"

  if ($opt_fbase == 1) echo " -fbase = fbase.base = $fbase\n"

  if ($opt_fdata == 1) echo " -fdata = fdata.dat = $fdata\n"

  if ($opt_fstmod == 1) echo " -fstmod = fstmod.cmod = $fstmod\n"

  if ($opt_frestore == 1) echo " -frestore = frestore.back = $frestore\n"

  if ($opt_ftag == 1) echo " -ftag = $ftag\n"

  if ($opt_nxz == 1) echo " -nxz = $Anxz\n"

  if ($opt_npop == 1) echo " -npop = $npop\n"

  if ($opt_varp == 1) echo " -varp = $varp\n"

  if ($opt_sigma == 1) echo " -sigma = $sigma\n"

  if ($opt_maxiter == 1) echo " -maxiter = $maxiter\n"

  if ($opt_dtau == 1) echo " -dtau = $dtau\n"

  if ($opt_mdacc == 1) echo " -mdacc = $mdacc\n"

  if ($opt_mindist == 1) echo " -mindist = $mindist\n"

  if ($opt_maxitertp == 1) echo " -maxitertp = $maxitertp\n"

  if ($opt_vrb == 1) echo " -vrb = $vrb\n"

  if ($opt_redirect == 1) echo " -redirect\n"

# -------------------------------------------------------------------
# If option not set, use a default or print an error
# -------------------------------------------------------------------

  echo ""
  echo "DEFAULTED ARGUMENTS:"
  echo ""

  if ($opt_tpath == 0) echo " -tpath = $tpath\n"

  if ($opt_fbase == 0) echo " -fbase = fbase.base = $fbase.base\n"

  if ($opt_fdata == 0) echo " -fdata = fdata.dat = $fdata.dat\n"

  if ($opt_sigma == 0) echo " -sigma = $sigma\n"

  if ($opt_maxiter == 0) echo " -maxiter = $maxiter\n"

  if ($opt_dtau == 0) echo " -dtau = $dtau\n"

  if ($opt_mdacc == 0) echo " -mdacc = $mdacc\n"

  if ($opt_mindist == 0) echo " -mindist = $mindist\n"

  if ($opt_maxitertp == 0) echo " -maxitertp = $maxitertp\n"

  if ($opt_vrb == 0) echo " -vrb = $vrb\n"

  echo "-------------------------------------------------------------"
  echo ""

# -------------------------------------------------------------------
# Set default values for tdarwin run
# -------------------------------------------------------------------

# File names
  set dc = "${varpint}p${varpfrc}"
  set fout = "${fdata}-dc${dc}-${nxz}drw"
  if ($opt_ftag == 1) then
    set fout = "${fout}-${ftag}"
  endif

  if ($opt_fstmod == 1) set fstmod = "${fstmod}.cmod"

  set fbase = "${fbase}.base"
  set fdata = "${fdata}.dat"
  set foutmod = "${fout}.cmod"
  set ftpf = "${fout}.tpf"
  set fdrwlog = "${fout}.log"
  set fbackup = "${fout}.back"
  set fexpl = "${fout}.expl"

# -------------------------------------------------------------------
# Output the commands of  the tdarwin script and Tommy tdarwin program
# to a log file (.params). $* passes all of the arguments to the script.
# -------------------------------------------------------------------

    set txt01 = "Call to tdarwin.csh"
    set txt02 = "-------------------"
    set txt03 = ""
    set txt04 = "../Scripts/tdarwin.csh $*"
    set txt05 = ""
    set txt06 = ""
    set txt07 = ""
    set txt08 = "Parameters used in Tommy tdarwin run"
    set txt09 = "------------------------------------"
    set txt10 = ""
    set txt11 = "$tpath/tdarwin"
    set txt12 = "base=$fbase"
    set txt13 = "data=$fdata"
    if (($opt_fstmod == 1) && ($opt_frestore == 0) ) then
      set txt14 = "inmod=$fstmod"
    else if (($opt_fstmod == 0) && ($opt_frestore == 1) ) then
      set txt14 = "restore=$frestore"
    else
      set txt14 = ""
    endif
    set txt15 = "param=$param"
    set txt16 = "intp=$intp"
    set txt17 = "nlay=$nlay"
    set txt18 = "std=$std"
    set txt19 = "nxp=$nxp"
    set txt20 = "nzp=$nzp"
    set txt21 = "npop=$npop"
    set txt22 = "varp=$varp"
    set txt23 = "sigma0=$sigma"
    set txt24 = "maxiter=$maxiter"
    set txt25 = "dtau=$dtau"
    set txt26 = "mdacc=$mdacc"
    set txt27 = "mindist=$mindist"
    set txt28 = "maxitertp=$maxitertp"
    set txt29 = "tol=$tol"
    set txt30 = "outmod=$foutmod"
    set txt31 = "expl=$fexpl"
    set txt32 = "backup=$fbackup"
    if ($opt_redirect == 1) then
      set txt33 = "vrb=$vrb >& $fdrwlog"
    else
      set txt33 = "vrb=$vrb |& tee $fdrwlog"
    endif
    set txt34 = ""
    set txt35 = ""
    set txt36 = ""
    set txt37 = "Call to Tommy raytrac program"
    set txt38 = "-----------------------------"
    set txt39 = ""
    set txt40 = "$txt11 $txt12 $txt13 $txt14 $txt15 $txt16 $txt17 $txt18 \
                 $txt19 $txt20 $txt21 $txt22 $txt23 $txt24 $txt25 $txt26 \
                 $txt27 $txt28 $txt29 $txt30 $txt31 $txt32 $txt33"

    echo $txt24

# Save the tdarwin run to the .params file
    echo $txt01 > $ftpf
    echo $txt02 >> $ftpf
    echo $txt03 >> $ftpf
    echo $txt04 >> $ftpf
    echo $txt05 >> $ftpf
    echo $txt06 >> $ftpf
    echo $txt07 >> $ftpf
    echo $txt08 >> $ftpf
    echo $txt09 >> $ftpf
    echo $txt10 >> $ftpf
    echo $txt11 >> $ftpf
    echo "    "$txt12 >> $ftpf
    echo "    "$txt13 >> $ftpf
    echo "    "$txt14 >> $ftpf
    echo "    "$txt15 >> $ftpf
    echo "    "$txt16 >> $ftpf
    echo "    "$txt17 >> $ftpf
    echo "    "$txt18 >> $ftpf
    echo "    "$txt19 >> $ftpf
    echo "    "$txt20 >> $ftpf
    echo "    "$txt21 >> $ftpf
    echo "    "$txt22 >> $ftpf
    echo "    "$txt23 >> $ftpf
    echo "    "$txt24 >> $ftpf
    echo "    "$txt25 >> $ftpf
    echo "    "$txt26 >> $ftpf
    echo "    "$txt27 >> $ftpf
    echo "    "$txt28 >> $ftpf
    echo "    "$txt29 >> $ftpf
    echo "    "$txt30 >> $ftpf
    echo "    "$txt31 >> $ftpf
    echo "    "$txt32 >> $ftpf
    echo "    "$txt33 >> $ftpf
    echo $txt34 >> $ftpf
    echo $txt35 >> $ftpf
    echo $txt36 >> $ftpf
    echo $txt37 >> $ftpf
    echo $txt38 >> $ftpf
    echo $txt39 >> $ftpf
    echo $txt40 >> $ftpf
    echo "" >> $ftpf

# -------------------------------------------------------------------
# Run tommy tdarwin program
# -------------------------------------------------------------------

  if (($opt_frestore == 0) && ($opt_redirect == 1)) then

      $tpath/tdarwin base=$fbase data=$fdata inmod=$fstmod                 \
          nxp=$nxp nzp=$nzp param=$param intp=$intp nlay=$nlay dtau=$dtau  \
          mdacc=$mdacc mindist=$mindist maxiterptp=$maxitertp              \
          std=$std npop=$npop varp=$varp sigma0=$sigma maxiter=$maxiter    \
          tol=$tol outmod=$foutmod expl=$fexpl backup=$fbackup             \
          vrb=$vrb >& $fdrwlog

  else if (($opt_frestore == 0) && ($opt_redirect == 0)) then

      $tpath/tdarwin base=$fbase data=$fdata inmod=$fstmod                 \
          nxp=$nxp nzp=$nzp param=$param intp=$intp nlay=$nlay dtau=$dtau  \
          mdacc=$mdacc mindist=$mindist maxiterptp=$maxitertp              \
          std=$std npop=$npop varp=$varp sigma0=$sigma maxiter=$maxiter    \
          tol=$tol outmod=$foutmod expl=$fexpl backup=$fbackup             \
          vrb=$vrb |& tee $fdrwlog

  else if (($opt_frestore == 1) && ($opt_redirect == 1)) then

      $tpath/tdarwin base=$fbase data=$fdata restore=$frestore            \
          nxp=$nxp nzp=$nzp param=$param intp=$intp nlay=$nlay            \
          dtau=$dtau mdacc=$mdacc mindist=$mindist maxiterptp=$maxitertp  \
          std=$std npop=$npop varp=$varp sigma0=$sigma maxiter=$maxiter   \
          tol=$tol outmod=$foutmod expl=$fexpl backup=$fbackup            \
          vrb=$vrb >& $fdrwlog

  else if (($opt_frestore == 1) && ($opt_redirect == 0)) then

      $tpath/tdarwin base=$fbase data=$fdata restore=$frestore            \
          nxp=$nxp nzp=$nzp param=$param intp=$intp nlay=$nlay            \
          dtau=$dtau mdacc=$mdacc mindist=$mindist maxiterptp=$maxitertp  \
          std=$std npop=$npop varp=$varp sigma0=$sigma maxiter=$maxiter   \
          tol=$tol outmod=$foutmod expl=$fexpl backup=$fbackup            \
          vrb=$vrb |& tee $fdrwlog

  endif

# Call this one

#/nethome/chrisd/Zollo/Chrisd/Tommy-1001/bin/tdarwin           \
#  base=m1.base data=$data.dat inmod=$inmod.vmod               \
#  nlay=1 param="P" intp="LIN" std=on                          \
#  nxp=$nx nzp=$nz npop=60 varp=5.0 sigma0=1000.0 maxiter=150  \
#  dtau=0.03 mdacc=0.1 mindist=0.05 maxitertp=10               \
#  outmod=$fout.vmod backup=$fout.bck expl=$fout.exp           \
#  tol=0.0 vrb=high |& tee $fout.log

# These are only for test

#/nethome/chrisd/Zollo/Chrisd/Tommy-1001/bin/tsimplex base=sunsp.base data=$data.dat nlay=1 param="P" intp="LIN" std=on inmod=$fout.vmod outmod=$fout.vmod nxp=$nx nzp=$nz varp=0.3 dtau=0.15 mindist=0.01 mdacc=0.1 backup=$fout.vmod expl=$fout.vmod sigma0=1500.0 maxiter=100 maxitertp=10 tol=0.0 vrb=medium |& tee $fout.log

#/home/dimech/Tommy/bin/tdarwin base=jcd.base data=jcd.dat nlay=1 param="P" intp="LIN" std=on inmod=jcd3x2-splx.mod varp=0.5 outmod=jcd6x4-darw.mod nxp="6" nzp="4" dtau=0.1 mindist=0.02 mdacc=0.04 backup=jcd_6x4_back expl=jcd_6x4_exp sigma0=1.0 maxiter=200 maxitertp=10 tol=0.0 vrb=medium |& tee jcd6x4-darw.log

#/home/dimech/Tommy/bin/tsimplex base=jcd.base data=jcd.dat nlay=1 param="P" intp="LIN" std=on inmod=jcd6x4-darw.mod outmod=jcd6x4-splx.mod nxp="6" nzp="4" varp=0.3 dtau=0.1 mindist=0.02 mdacc=0.04 backup=jcd6x4-splx.bck expl=jcd6x4-splx.exp sigma0=1.0 maxiter=100 maxitertp=10 tol=0.0 vrb=medium |& tee jcd6x4-splx.log



i examine your script :b:

well enough :wink:

add in your script

set echo_style=both

or change your echo lines with

if ($opt_fstmod == 1) /bin/echo -e " -fstmod = fstmod.cmod $fstmod\n"

regards
ygemici

So what's the problem with the script buddy? :rolleyes:

---------- Post updated at 03:46 PM ---------- Previous update was at 03:40 PM ----------

I only get the problem on some systems and not in others.

this is not related your script..script is very fine :b:
this issue is related your c subshell options which variable of echo_style (in this echo is shell builtin echo )
probably it is set to bsd still as default and it cause of some problems like this example (recognized \n \t and others..)

good works
regards