I have simple script. Script can be run with specific arguments. For example:
./my-script.sh --last-name=Smith --first-name=John
There is called
curl and sended POST-request in script:
curl --data-urlencode last_name=$lastName --data-urlencode first_name=$firstName https://example.com
lastName are variables, that parsed from arguments.
Issue, that firstName or lastName (but not both) can be missed. If argument is missed, appropriate parameter do not sended to server.
But I do not know, how I can implement this logic in scripts.
Ofcouse, I can add
if to check argument on null, but I can have much arguments in command line and in this case I will have tons of