[Gmsh] Question about the command line

sebastian.eiser at k-ai.at sebastian.eiser at k-ai.at
Wed Jun 11 10:23:49 CEST 2014


I’m not aware of passing an argument, but on the command line you can always run programs sequentially in a shell script. E.g.

#!/bin/bash

# stop script on error (optional):
set –e
# stop script if you forgot to pass an argument
set –o nounset

# $1 is the first argument of your new script
intNumber=$1

# first edit your script, e.g. using sed
sed "s/replacement string/$intNumber/" myscript.sh > tmpscript.pos

# then run gmsh
gmsh myfile.msh tmpscript.pos

Now, set permissions (chmod +x newscript.sh) and just run the script on the command line like this

$ ./newscript.sh 54321

-S

From: gmsh [mailto:gmsh-bounces at ace20.montefiore.ulg.ac.be] On Behalf Of Alexis PACHOLIK
Sent: 03 June, 2014 19:17
To: gmsh at geuz.org
Subject: [Gmsh] Question about the command line

Hello all,
I'd like to know if I can get back an integer given in command line. For example, if I put "gmsh myfile.msh myscript.sh 54321" in the command line where myfile.msh is my mesh and myscript.sh is a script for postprocessing, how can I use the integer 54321 in the file myscript.sh (if possible)?  I'm not aware of something like argv[] or else...
Thank you and regards,
Alexis PACHOLIK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20140611/6a8a46a2/attachment.html>