That's a great question! To test different argument counts for your arguments.sh script, you simply execute the script from your terminal and provide a varying number of words (which will be treated as arguments) after the script name.
Here are a few examples to help you try it out:
-
To test with zero arguments:
./arguments.shThis should output: "No arguments provided."
-
To test with one argument:
./arguments.sh appleThis should output: "One argument provided: apple"
-
To test with two arguments:
./arguments.sh banana orangeThis should output: "Two arguments provided: banana and orange"
-
To test with more than two arguments (e.g., three arguments):
./arguments.sh cherry grape kiwiThis should output:
"More than two arguments provided:
First argument: cherry
Second argument: grape
Third argument: kiwi
Total number of arguments: 3"
By trying these commands, you can see how your script behaves for each case defined by the if, elif, and else statements! Give it a try in your terminal.