yapp=fig2.psand with the versatile yapp_pgplot interface the output can be redirected to a larger number of interactive and non-interacive devices, e.g.
yapp=3/xs yapp=fig4.ps/ps yapp=color.ps/cps
However to write scripts in a portable way (semi-automatically switching devices) and incrementing figure numbers in case there are more than one, can be a bit challenging.
# before the script starts, assign two variables and initialize the $yapp set yapps = yapp%d.ps/vcps # yapp printf string (%d/xs, yapp%d.ps/vcps) set yappn = 1 # first yapp number set yapp = ‘printf $yapps $yappn‘ ; @ yappn++ # increment counter # call you program that needs the yapp=$yapp argument # but follow it with the incrementor line tabplot .... yapp=$yapp set yapp=‘printf $yapps $yappn‘ ; @ yappn++So each time a new figure is made, the set yapp= line needs to be cloned. Awkward. Lets see how this works in (BA)SH:
yapp() { if test $yapp = "xs"; then echo $1/$yapp elif test $yapp = "_ps"; then echo fig$1.ps else echo fig$1.$yapp/$yapp fi }with this definition your code can simply do things like
yapp=xs # pick ’xs’, ’ps’, ’png’, ’_ps’ echo yapp=$(yapp 11) # this should diplay a nice yapp= formatted line
03-Jul-19 Created PJT 27-dec-2019 added bash example PJT 14-jul-2021 example PJT