Skip to content

Instantly share code, notes, and snippets.

@miladvafaeifard
Created April 21, 2021 21:32
Show Gist options
  • Save miladvafaeifard/67cd7190bf9ae58be3a4d03045dda032 to your computer and use it in GitHub Desktop.
Save miladvafaeifard/67cd7190bf9ae58be3a4d03045dda032 to your computer and use it in GitHub Desktop.
#!/bin/bash
# --------------------------------
<< 'user-option-prompting'
while getopts "s:e:w:" option; do
case "${option}" in
w) WS=${OPTARG};;
s) SUBSCRIPTION=${OPTARG};;
e) EXCLUDE=${OPTARG};;
esac
done
echo $WS
user-option-prompting
# --------------------------------
<< 'counter-example'
COUNTER=0
while [ $COUNTER -lt 10 ]; do
echo The counter is $COUNTER
let COUNTER=COUNTER+1
done
counter-example
# --------------------------------
<< 'print-{A..F}-looping'
while [[ $# -gt 0 ]]; do
echo $1
shift
done
print-{A..F}-looping
# --------------------------------
<< 'print-without-suffix'
for pdf in ./SRN/*.yml; do
echo ${pdf%.yml}
done
for i in ./SRN/*.yml; do
pre=${i#./SRN/}
echo ${pre%.yml};
done
print-without-suffix
# --------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment