sh-compatible shell scripts that uses the arguments on the command line will often contain either
$3 etc. or
$* or combinations thereof. However, this is neither necessary nor sufficient!
This greps the script and returns all lines that contains these kinds of strings:
grep '\$[1-9@*]' script.sh
You may get false positives from scripts that don't take command line arguments but that contain functions that takes arguments, or scripts that simply contains these characters in unevaluated strings. If the script contains calls to
awk for example, then these may also contain
$1 etc. that does not refer to the command line arguments of the script itself.
You may also look for the string
getopt in the script to see whether the script uses
getopts to do proper parsing of the command line.
Catching the cases where the command line arguments may be used implicitly is a bit harder. This happens, for example, with
for variablename; do ... done or
select variablename; do ... done. But if the script has used
set to populate the positional parameters explicitly, then this doesn't touch any command line arguments. Visual inspection of the script may be needed to sort this out.
In "real life", one would read the accompanying documentation. If for whatever strange reason that's not available, then read the code.