#!/bin/csh -fx
set my_path = "/cd/home/dir"
cd $my_path
set path1 = `ls -1 | grep "abc" | head -1`
set path2 = `ls -1 | grep "def" | head -1`
1)#如何检查path1是否有分配给它的目录
if(-d $path1)then #this checks if the variable is defined but I want to check if it has a dir assigned?
#some function
else
endif
if(-d $path2)then
#execute
else
endif
就我而言path1
,并不是path2
每次都创建,或者path1
或path2
将被创建,当我运行它时,我得到如下所述。例如:- 未创建路径2
if: Missing file name.
如果未创建或缺少文件名,则应转到 endif。请帮忙