his bash file must be like this:
#!/bin/bash
enable next line for debugging purpose
set -x
############################################
User Configuration
############################################
adapt this path to your needs
#export PATH=~/Research/Checking_Bulk_GPT/output:$PATH
#gptPath="~/snap.bak/bin/gpt"
export PATH=~/progs/snap/bin:$PATH
gptPath="/home/shosseini/snap.bak/bin/gpt"
#gptPath=“gpt”
############################################
Command line handling
############################################
first parameter is a path to the graph xml
graphXmlPath="$1"
#graphXmlPath="/home/shosseini/Research/Checking_Bulk_GPT/outout/spk.xml"
second parameter is a path to a parameter file
#parameterFilePath="$2"
use third parameter for path to source products
sourceDirectory="$2"
#sourceDirectory="/home/shosseini/Research/Checking_Bulk_GPT"
use fourth parameter for path to target products
targetDirectory="$3"
#targetDirectory="/home/shosseini/Research/Checking_Bulk_GPT/output"
the fifth parameter is a file prefix for the target product name, typically indicating the type of processing
targetFilePrefix="$4"
#targetFilePrefix=“spk”
############################################
Helper functions
############################################
removeExtension() {
file="1"
echo "(echo “file" | sed -r 's/\.[^\.]*//’)”
}
############################################
Main processing
############################################
Create the target directory
mkdir -p “${targetDirectory}”
the d option limits the elemeents to loop over to directories. Remove it, if you want to use files.
for F in (ls -1d "{sourceDirectory}"/S1*.SAFE); do
sourceFile="$(realpath “F")"
targetFile="{targetDirectory}/{targetFilePrefix}_(removeExtension “(basename {F})”).dim”
echo “Executing :” “{gptPath} {graphXmlPath} -e -t {targetFile} {sourceFile}”
#echo “===============”
#{gptPath} {graphXmlPath} -e -p {parameterFilePath} -t {targetFile} {sourceFile}
{gptPath} {graphXmlPath} -e -t {targetFile} ${sourceFile}
done