Can someone show me an example how to use getopts properly or any other technique that I would be able to pass in an argument? I am trying to write this in unix shell/bash. I am seeing there is getopt and getopts and not sure which is better to use. Eventually, I will build this out to add for more options.
In this case, I want to pass the filepath as input to the shell script and place a description in the case it wasn't entered correctly.
export TARGET_DIR="$filepath"
For example: (calling on the command line)
./mytest.sh -d /home/dev/inputfiles
Error msg or prompt for correct usage if running it this way:
./mytest.sh -d /home/dev/inputfiles/