GNU/Linux Bash Check Command Line Parameter
Example script with a check on the number of submitted parameters.
#!/bin/bash
[ $# -ne 1 ] && echo "ERROR: Input Required" && exit 1;
echo $1
Example script with a check on the number of submitted parameters.
#!/bin/bash
[ $# -ne 1 ] && echo "ERROR: Input Required" && exit 1;
echo $1
A simple bash-script for OpenShift to determine which deployment configs make use of a specific secret (within the active project).
#!/bin/bash
oc get dc -o custom-columns="Name:metadata.name,readyReplicas:status.availableReplicas,Volumes:spec.template.spec.volumes,env:spec.template.spec.containers[].env,envFrom:spec.template.spec.containers[].envFrom,Volumes:spec.template.spec.volumes" | grep -E "($1)" | grep -oE "^[a-z0-9-]{3,99}"
$ os-sec-usage.sh secretname
Bash script to auto-mount NFS share when it is available (and not already mounted).
#!/bin/bash
ping -c 1 -n 192.168.1.250 > /dev/null
if [ $? -eq 0 ] && [ ! -d /mnt/nas1/directory ]; then
sudo mount -t nfs 192.168.1.250:/mnt/nfsmountpoint /mnt/nas1
fi