#! /bin/bash # # Crontab apparently doesn't run a startup script. if [ "$EXE" = "" ]; then source /root/.bash_profile source /root/.bashrc source /etc/profile fi mkenv=$(which mkenv) # Initialize loop limits $mkenv -sym -set PTN=20 $mkenv -sym -set PTR=20 # Safety belt: remove the loop counters (the same is done at # the end of the script, so if the script is allowed to run # its cours, this is redundant) $mkenv -sym -del PWN $mkenv -sym -del PWR # Define local variables by reading the symbols: # ptn and ptr are set to the loop limits. # pwn and pwr are set to the null string. # This ensures that the while loop is entered, and that # pwinput initializes properly. ptn=$($mkenv -sym -get -value_only PTN) ptr=$($mkenv -sym -get -value_only PTR) pwn=$($mkenv -sym -get -value_only PWN) pwr=$($mkenv -sym -get -value_only PWR) while [ "$pwn" != "$ptn" -o "$pwr" != "$ptr" ]; do # pwinput reads the counters pwn and pwr from LOGFIL.TXT, # resets them, creates the input file for ipsg2 and # stores the new values for pwn and pwr back in LOGFIL.TXT. $EXE/pwinput if [ $? != 1 ]; then exit 0 fi # Pick up the modified values pwn and pwr pwn=$($mkenv -sym -get -value_only PWN) pwr=$($mkenv -sym -get -value_only PWR) echo Now at PWN=$pwn and PWR=$pwr , PTN=$ptn , PTR=$ptr # Make a file name for the screen output of ipsg2 based on the # current values of pwn and pwr. screen_output="$TUB/ipsg2_$pwn$pwr.say" # ipsg2 writes screen output to the 'screen_output' file. # It also creates a t3d file and an ul file for Ulysses # in the working directory. These will be moved (and renamed) # to $TUB. $EXE/ipsg2 < $TUB/ipsg2.input > $screen_output if [ $? != 1 ] exit 0 fi # ipsg2 creates two output files: a t3d* and an ul* file. # Rename both to make room for the next run of ipsg2. t3d_file="$TUB/$pwn$pwr.t3d" ul_file="$TUB/$pwn$pwr.ul" # We assume that the ls command will return one file only !!! mv $(ls t3d*.*) $t3d_file mv $(ls ul*.*) $ul_file done # Delete all symbols: PWN, PWR, PTN, PTR $mkenv -sym -del PTN $mkenv -sym -del PTR $mkenv -sym -del PWN $mkenv -sym -del PWR exit 1