未验证 提交 1f429744 编写于 作者: C Chen Mulong 提交者: GitHub

Fix source greenplum_path.sh error with set -u (#11085)

The error was introduced by dc96f667.
If `set -u` was called before sourcing greenplum_path.sh with bash, an
error `ZSH_VERSION: unbound variable` would be reported.
To solve the issue, use shell syntax `{:-}` which will output an empty
value if the variable doesn't exist.

Tested with zsh, bash and dash.
上级 777b51cd
#!/usr/bin/env bash
cat <<"EOF"
if test -n "$ZSH_VERSION"; then
if test -n "${ZSH_VERSION:-}"; then
# zsh
SCRIPT_PATH="${(%):-%x}"
elif test -n "$BASH_VERSION"; then
elif test -n "${BASH_VERSION:-}"; then
# bash
SCRIPT_PATH="${BASH_SOURCE[0]}"
else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册