I have written a bash script that gets three paths based on input parameters and then then gets the imagename/filename in the path.
Something like: I provide:
Use a different variable name than PATH. $PATH is the environment variable which tells your shell where to look for executables (so, e.g., you can run ls instead of /bin/ls).
PATH
$PATH
ls
/bin/ls