In bash you can use [[ pattern =~ regex ]]
to match on a conditional:
if [[ "hello world" =~ ^hell ]]; then
echo Match
else
echo No match
fi
In bash you can use [[ pattern =~ regex ]]
to match on a conditional:
if [[ "hello world" =~ ^hell ]]; then
echo Match
else
echo No match
fi
function mkcolor() | |
{ | |
export $1="${2}" ${1}_E="\[${2}\]" | |
case "$1" in | |
BOLD|RESET) | |
return | |
;; | |
*) | |
export ${1}_B="$(tput bold)${2}" # Bold |
#!/bin/bash | |
# | |
# Install: copy to path | |
# $ cp kubectl-extract /usr/local/bin | |
# | |
# Usage: | |
# $ kubectl extract -n default my-secret | |
# |
Create the file stop-proc
below:
#!/bin/bash
SIG=${0##*/} ## basename only (name of the file itself, no dirs)
SIG=${SIG%-*} ## remove filename suffix. "-*" is a glob pattern ("stop" in this case)
SIG=${SIG^^} ## UPPERCASE all letters
## read process from command line or use this as default.
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
case "$1" in | |
-h|--help) | |
echo "Usage: $0 [phase]" | |
echo "" | |
echo "Default phases, in this order: " | |
echo " download Download all required tools into current directory" | |
echo " credentials Ask for missing credentials" | |
echo " create-manager-cluster Create Manager Cluster, used to create \"real\" Clusters" |
#!/usr/bin/python | |
from __future__ import print_function | |
import sys | |
def usage(argv): | |
print('Usage: %s [commands][resources][options][parameters]' % argv[0], file=sys.stderr) | |
print('\nCommands:', file=sys.stderr) | |
for s, l in commands: | |
print(' %s (%s)' % (s, l), file=sys.stderr) |
#!/bin/bash | |
if [ $# -lt 3 ]; then | |
echo "Usage: $0 pod-name-suffix source-pvc-name destination-pvc-name [rsync options...]" | |
exit 1 | |
fi | |
POD_SUFFIX=${1} | |
PVC_FROM=${2} | |
PVC_TO=${3} |