#!/bin/bash ############################################################# # BEGINNING OF USER INPUT ZONE # Name of the file that contains the high-resolution spectrum SPECTRUM_FILE=k001 # Name of the file that is used by gnuplot GNUPLOT_FILE=gra_k0 # Plot (1) sigma(nu) or (2) k(nu) variable=2 # Use (1) y-logscale or (0) not ylogscale=1 echo "HOSTNAME="$HOSTNAME if [ $HOSTNAME == 'rhea' -o $HOSTNAME == 'rhea.local' ] then statcommand='stat -c %Y' elif [ $HOSTNAME == 'titan' -o $HOSTNAME == 'titan.local' ] then statcommand='gstat -c %Y' else statcommand='stat -f %m' fi # END OF USER INPUT ZONE ############################################################# LIST=$SPECTRUM_FILE' '$GNUPLOT_FILE if [ -f $SPECTRUM_FILE ] then if [ -f ./f1 ] then ./f1 else echo "File is missing: f1" exit 1 fi if [ ! -f ./make_title.exe ] then echo "The was a problem while compiling make_title.exe" exit 1 else echo $SPECTRUM_FILE > ./spectrum_file ./make_title.exe while read line do status=$line done < "./status_p1" if [ $status -ne 0 ] then echo 'Error from run.bash' echo "Something went wrong during the execution of" echo "make_title.exe" echo "please debug" exit 1 else if [ ! -f ./plot_title.txt ] then echo "make_title.exe was executed" echo "but result file is missing: plot_title.txt" exit 1 fi # ! -f ./plot_title.exe fi # $status -ne 0 fi # ! -f ./make_title.exe rm -f gra_k01_01_sigma rm -f gra_k01_01_k cp gra_k0_sigma gra_k0_01_sigma cp gra_k0_k gra_k0_01_k rpl "FILE" $SPECTRUM_FILE gra_k0_01_sigma rpl "FILE" $SPECTRUM_FILE gra_k0_01_k rm -f ./ylabel.txt rm -f ./gra_k0_01 rm -f $GNUPLOT_FILE if [ $variable -eq 1 ] then cp ylabel_sigma.txt ylabel.txt cp gra_k0_01_sigma gra_k0_01 elif [ $variable -eq 2 ] then cp ylabel_k.txt ylabel.txt cp gra_k0_01_k gra_k0_01 else echo "Unknown value: variable="$variable exit 1 fi if [ $ylogscale -eq 0 ] then cat plot_title.txt xlabel.txt ylabel.txt gra_k0_01 > $GNUPLOT_FILE elif [ $ylogscale -eq 1 ] then cat plot_title.txt xlabel.txt ylabel.txt logscaley.txt gra_k0_01 > $GNUPLOT_FILE else echo "Unknown value: ylogscale="$ylogscale fi else echo "File is missing: "$SPECTRUM_FILE exit 1 fi # -f $SPECTRUM_FILE echo "Press CTRL+C to quit this script..." s0=0 for file in $LIST do if [ -f $file ] then # s0=$(($s0+$($statcommand -c %Y $file))) s0=$(($s0+$($statcommand $file))) fi done i=1 while [ $i -gt 0 ] do gnuplot gra_res if [ $i -eq 1 ] then gv --orientation=LANDSCAPE -watch res.ps & fi s1=$s0 while [ $s1 -eq $s0 ] do s1=0 for file in $LIST do if [ -f $file ] then # s1=$(($s1+$($statcommand -c %Y $file))) s1=$(($s1+$($statcommand $file))) fi done sleep 1s done s0=$s1 i=$[$i+1] done exit 0