Skip to content

Instantly share code, notes, and snippets.

@gingerbeardman
Last active September 14, 2021 21:42
Show Gist options
  • Select an option

  • Save gingerbeardman/7a8ba112e87892767baf7c9cd8d68a01 to your computer and use it in GitHub Desktop.

Select an option

Save gingerbeardman/7a8ba112e87892767baf7c9cd8d68a01 to your computer and use it in GitHub Desktop.
List command line switches and arguments
#!/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