Skip to content

Instantly share code, notes, and snippets.

View MartenH's full-sized avatar

Mårten Hildell MartenH

View GitHub Profile
@MartenH
MartenH / arguments.sh
Created April 2, 2020 07:12
bash, arguments
#!/bin/bash
if [[ "$1" = "" ]]; then
echo "Usage:"
echo " -a foo|bar Select foo or bar"
echo " -v verbose (set -x)"
echo " --arg1 One arg"
echo ""
echo "Example:
echo " ./arguments.sh -a foo --arg1"
@MartenH
MartenH / select.sh
Created April 2, 2020 07:09
Bash, select
#!/bin/bash
all_done=0
while (( !all_done )); do
options=("do-1" "do-2" "Quit")
select opt in "${options[@]}"
do
case $opt in
"do-1")