-1

有人知道这个错误是什么意思吗? Missing -.在谷歌我什么都没发现

4

1 回答 1

2

tcsh 可以产生该错误消息的唯一情况是当您尝试从数组变量中替换一系列单词时,并且选择器在语法上不正确。

引用 tcsh 手册页:

   $name[selector]
   ${name[selector]}
           Substitutes  only  the  selected  words from the value of name.
           The selector is subjected to `$' substitution and  may  consist
           of  a  single  number  or  two numbers separated by a `-'.  The
           first word of a variable's value is numbered `1'.  If the first
           number  of  a range is omitted it defaults to `1'.  If the last
           member of a range is omitted  it  defaults  to  `$#name'.   The
           selector `*' selects all words.  It is not an error for a range
           to be empty if the second argument is omitted or in range.

例如:

$ echo $path[5-6]
/usr/sbin /usr/bin
$ echo $path[5_6]
Missing -.

也许如果您在被要求提供更多信息时跟进(例如,失败脚本中的一些代码),则不会花费一年多的时间来获得答案。

于 2011-08-23T01:45:01.767 回答