defined(…)
作用
条件表达式函数,判断变量是否已定义。
语法
if defined(${HOME}) {
gx.echo(value: "has home");
}
if !defined(${NO_SUCH_VAR}) {
gx.echo(value: "missing");
}
说明:
- 这是表达式函数,不是
gx.defined命令。
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
条件表达式函数,判断变量是否已定义。
if defined(${HOME}) {
gx.echo(value: "has home");
}
if !defined(${NO_SUCH_VAR}) {
gx.echo(value: "missing");
}
说明:
gx.defined 命令。