Skip to content

Instantly share code, notes, and snippets.

@serious-angel
Last active February 12, 2026 18:54
Show Gist options
  • Select an option

  • Save serious-angel/663a4d45dafabb21565bd1493148af01 to your computer and use it in GitHub Desktop.

Select an option

Save serious-angel/663a4d45dafabb21565bd1493148af01 to your computer and use it in GitHub Desktop.
Multi-line comments example
$ bash ./test.sh;
declare -- bitfields="101"
declare -a scopes=([0]="user-profile" [1]="user-email")
See! Marvelous!
#! /usr/bin/env bash
_Request()
{
declare bitfields="$1";
shift 1 || return 2;
# Let's imagine proper CLI options parsing here for `--scopes`.
shift 1 || return 2;
declare scopesString="$1";
shift $# || return 2;
declare scopes=();
readarray -td : -- scopes < <( printf '%s' "$scopesString"; );
declare -p bitfields scopes;
}
_Main()
{
_Request \
'1'` # Enable updates service
`'0'` # Disable monitoring
`'1'` # Enable status endpoint` \
--scopes `
# Public User profile data
`'user-profile'`
# Private User Email address access
`':user-email'`
# Other options
` "$@" \
|| \
return $?;
printf 'See! Marvelous!\n';
}
_Main "$@";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment