Unix 无法将-h与文件tcsh一起使用
我无法对文件使用-h test标志来确定它是否是tcsh中的符号链接 这是我的代码片段和错误Unix 无法将-h与文件tcsh一起使用,unix,symlink,tcsh,Unix,Symlink,Tcsh,我无法对文件使用-h test标志来确定它是否是tcsh中的符号链接 这是我的代码片段和错误 #!/bin/tcsh foreach i (`ls`) if ( -h "$i" ) then echo $i endif end 错误:如果:数字格式错误 我做错什么了吗 #!/bin/tcsh foreach i (*) if ( -l "$i") then echo "$i" endif end 第一:*比ls好。第二:您想要的测试是-l,而
#!/bin/tcsh
foreach i (`ls`)
if ( -h "$i" ) then
echo $i
endif
end
错误:如果:数字格式错误
我做错什么了吗
#!/bin/tcsh
foreach i (*)
if ( -l "$i") then
echo "$i"
endif
end
第一:
*
比ls
好。第二:您想要的测试是-l
,而不是-h
。tcsh
的测试与/bin/test
(或[…]
)不同。检查(子)部分文件查询操作符。不要使用tcsh编写脚本shell,最好使用标准POSIX shell或bash。