Ad

You don't care if there are more than one parameter, as long as there is at least one

Code
Diff
  • #!/bin/bash
    
    echo Hello Bash!
    
    if [ $# -ne 0 ]; then
      echo "Hello, $1!"
    else
      echo "No parameters found."
    fi
    • #!/bin/bash
    • echo Hello Bash!
    • if [ $# -eq 1 ]; then
    • if [ $# -ne 0 ]; then
    • echo "Hello, $1!"
    • else
    • echo "No parameters found."
    • fi