Last active
September 14, 2021 21:42
-
-
Save gingerbeardman/7a8ba112e87892767baf7c9cd8d68a01 to your computer and use it in GitHub Desktop.
List command line switches and arguments
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| POSITIONAL=() | |
| while [[ $# -gt 0 ]]; do | |
| key="$1" | |
| value="$2" | |
| shift # past argument | |
| shift # past value | |
| echo "$key $value" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment