Results for “Arguments & decisions”
Small, practical examples. Search by task or narrow things down below.
Consume positional arguments one at a time
Bash Scripts: Check the argument count before accessing the first parameter with nounset enabled.
Bash Scripts✓ Tested
Forward all arguments without changing their boundaries
Bash Scripts: Quoted at-sign preserves empty arguments and embedded spaces.
Bash Scripts✓ Tested
Validate the number of positional arguments
Bash Scripts: Use the argument count to enforce a simple command-line contract.
Bash Scripts✓ Tested
Choose among several numeric ranges
Bash Scripts: An if-elif chain evaluates branches in order and executes the first match.
Bash Scripts✓ Tested
Classify a filename with shell patterns
Bash Scripts: Case patterns support alternatives without launching an external regex tool.
Bash Scripts✓ Tested
Compare a value literally inside a conditional
Bash Scripts: Quoting the right side of an equality test makes wildcard characters literal.
Bash Scripts✓ Tested
Parse a small set of long options
Bash Scripts: Use a loop and case statement to consume a value-bearing long option.
Bash Scripts✓ Tested
Repeat until a condition becomes true
Bash Scripts: An until loop continues while its test returns a nonzero status.
Bash Scripts✓ Tested
Skip selected iterations in a loop
Bash Scripts: Continue starts the next iteration without running the remaining loop body.
Bash Scripts✓ Tested
Stop a search loop at the first match
Bash Scripts: Break exits the current loop as soon as the desired item is found.
Bash Scripts✓ Tested
Accept a variable number of arguments
Accept a variable number of arguments using a complete Go program with explicit sample inputs.
Go✓ Tested
Combine a stable entrypoint with default arguments
Docker / Compose: CMD supplies default arguments to an exec-form ENTRYPOINT.
Docker / Compose✓ Tested