While running or when starting? Both need a different approach.
For the first one read <var>
comes to mind.
The second one can be done in several ways, but script <inputfile>
is often used. The name of the inputfile is represented as $1
($2 being the second option, $3 being the third. I.e: script file1 file2 file3).
Although you can use $1 in all of the script, for readability you transfer it to a "human readable" variable (inputfile="$1") and work with inputfile in the rest of the script.
These questions seem to be hypothetical, if you want a good guide to bash scripting take a look here: Advanced Bash-Scripting Guide
Hope this helps.