PTFM-12607 Improving bash helper variables

Summary:
1. Refactoring of code, so as to acheive sharing, between local and remote execution.
2. Adding several bash variables available to the application: filenames, prefixes, and paths.

Test Plan: additional app for testing.

Reviewers: klai

Reviewed By: klai

Subscribers: psung

Differential Revision: https://phabricator.dnanexus.com/D88