You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sledge/runtime/experiments/bash_libraries/generate_gnuplots.sh

37 lines
1.0 KiB

# shellcheck shell=bash
if [ -n "$__generate_gnuplots_sh__" ]; then return; fi
__generate_gnuplots_sh__=$(date)
source "panic.sh" || exit 1
# Runs all *.gnuplot files found gnuplot_directory from results_directory
# Outputting resulting diagrams in results_directory
# $1 - results_directory containing the data file referenced in the gnuplot file
# $2 - gnuplot_directory containing the *.gnuplot specification files
generate_gnuplots() {
local -r results_directory="$1"
local -r experiment_directory="$2"
if ! command -v gnuplot &> /dev/null; then
panic "gnuplot could not be found in path"
return 1
fi
# shellcheck disable=SC2154
if [ -z "$results_directory" ]; then
panic "results_directory was unset or empty"
return 1
fi
# shellcheck disable=SC2154
if [ -z "$experiment_directory" ]; then
panic "error: EXPERIMENT_DIRECTORY was unset or empty"
return 1
fi
cd "$results_directory" || exit
shopt -s nullglob
for gnuplot_file in "$experiment_directory"/*.gnuplot; do
gnuplot "$gnuplot_file"
done
cd "$experiment_directory" || exit
}