Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX-compliant fix for scripts #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion kubefunc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ function install-kubectl() {
ROOTFS=${HOME};
BIN_DIR=bin;
K8S_URL=${K8S_URL:-https://storage.googleapis.com/kubernetes-release/release};
curl -sfSL ${K8S_URL}/${K8S_VERSION}/bin/${OS,,}/${ARCH}/kubectl > ${ROOTFS}/${BIN_DIR}/kubectl;
OS_LOWER=$(echo "${OS}" | tr '[:upper:]' '[:lower:]')
curl -sfSL ${K8S_URL}/${K8S_VERSION}/bin/${OS_LOWER}/${ARCH}/kubectl > ${ROOTFS}/${BIN_DIR}/kubectl;
[[ $? -ne 0 ]] && echo "ERROR: could not download kubectl" && return 1;
chmod +x ${ROOTFS}/${BIN_DIR}/kubectl;
echo "Installed kubectl in ${BIN_DIR}/kubectl"
Expand Down
5 changes: 4 additions & 1 deletion pod-logs/pod-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ function _kube_list_pod_containers() {
while [[ $sel -lt 1 || $sel -gt $count ]]; do
read -p "Select a Container: " sel >&2
done
else
local sel=1
fi
echo "${items[(sel-1)]}"
}

SEL=$(_kube_list_pods)
IFS=":" read -ra POD <<< "${SEL}"

if [[ "${POD[2],,}" != "running" ]]; then
POD_STATUS=$(echo "${POD[2]}" | tr '[:upper:]' '[:lower:]')
if [[ "${POD_STATUS}" != "running" ]]; then
echo "ERROR: Pod ${POD[0]} is not running" >&2
exit 1
fi
Expand Down
5 changes: 4 additions & 1 deletion pod-shell/pod-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ function _kube_list_pod_containers() {
while [[ $sel -lt 1 || $sel -gt $count ]]; do
read -p "Select a Container: " sel >&2
done
else
local sel=1
fi
echo "${items[(sel-1)]}"
}

SEL=$(_kube_list_pods)
IFS=":" read -ra POD <<< "${SEL}"

if [[ "${POD[2],,}" != "running" ]]; then
POD_STATUS=$(echo "${POD[2]}" | tr '[:upper:]' '[:lower:]')
if [[ "${POD_STATUS}" != "running" ]]; then
echo "ERROR: Pod ${POD[0]} is not running" >&2
exit 1
fi
Expand Down