How can you test other argument counts?

QuestionsQuestions4 SkillsProDec, 13 2025
0157

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:

  1. To test with zero arguments:

    ./arguments.sh
    

    This should output: "No arguments provided."

  2. To test with one argument:

    ./arguments.sh apple
    

    This should output: "One argument provided: apple"

  3. To test with two arguments:

    ./arguments.sh banana orange
    

    This should output: "Two arguments provided: banana and orange"

  4. To test with more than two arguments (e.g., three arguments):

    ./arguments.sh cherry grape kiwi
    

    This 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.

0 Comments

no data
Be the first to share your comment!