c shl 的一段合并文件的代码看不懂
ls -1d *|grep 'ltttdb02_[1-8].if$ '
还有一段
while ($COUNT <= $#FILENMI)
......
@COUNT++
END
变量前面加#是什么意思?
COUNT变量引用时前面为什么加@?
谢谢
[解决办法]
man ls
-1 list one file per line
-d, --directory
list directory entries instead of contents, and do not dereference symbolic links
ls -1d *
列出目录内容,不要解引用符号链接,一行一个记录。
grep的那个正则表示找出例如‘ltttdb02_1.if’‘ltttdb02_7’的文件。
man csh
$#name
${#name}
Substitutes the number of words in name.
即FILENMI中如果是个文件列表,$#FILENMI表示列表中有多少个文件。
@
@ name = expr
@ name[index] = expr
@ name++|--
@ name[index]++|--
The first form prints the values of all shell variables.
The second form assigns the value of expr to name. The third
form assigns the value of expr to the index’th component of
name; both name and its index’th component must already exist.
expr may contain the operators ‘*’, ‘+’, etc., as in C. If
expr contains ‘<’, ‘>’, ‘&’ or ‘’ then at least that part of
expr must be placed within ‘()’. Note that the syntax of expr
has nothing to do with that described under Expressions.
The fourth and fifth forms increment (‘++’) or decrement (‘--’)
name or its index’th component.
The space between ‘@’ and name is required. The spaces between
name and ‘=’ and between ‘=’ and expr are optional. Components
of expr must be separated by spaces.
@ COUNT++表示COUNT加一,主要要有空格。