$?VAR在csh中是什么意思? [英] What does $?VAR mean in csh?

查看:367
本文介绍了$?VAR在csh中是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了用csh编写的这段代码:

I've encountered this code written in csh:

if ( ! $?LM_LICENSE_FILE ) then
    setenv LM_LICENSE_FILE $_LmLicense
else
    switch("$LM_LICENSE_FILE")
    case *${_LmLicense}*:
         breaksw
    default:
         setenv LM_LICENSE_FILE "${_LmLicense}:$LM_LICENSE_FILE"
    endsw
endif

请注意以下一行:

if ( ! $?LM_LICENSE_FILE ) then

$?$?LM_LICENSE_FILE中做什么?

LM_LICENSE_FILE是一个shell变量(或更确切地说是宏),我知道$LM_LICENSE_FILE用于检索其值,但是$之后的尾随问号,即$?LM_LICENSE_FILE,是什么它的含义?

LM_LICENSE_FILE is a shell variable (or macro, more precisely), and I know that $LM_LICENSE_FILE is used to retrieve its value, but a trailing question mark following $, that is $?LM_LICENSE_FILE, what is its meaning?

推荐答案

$?VAR如果将$VAR设置为(true,则为空字符串),则扩展为1(true),如果未设置,则扩展为0(false). t.

$?VAR expands to 1 (true) if $VAR is set (to anything, even the empty string), 0 (false) if it isn't.

csh手册中对此进行了说明.按照链接搜索$?,或键入man cshman tcsh.

This is documented in the csh manual; follow the link and search for $?, or type man csh or man tcsh.

哦,而且csh没有宏.

Oh, and csh doesn't have macros.

这篇关于$?VAR在csh中是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆