我想使用LATEST_FILE=`ls -rt $INPUT_LOCATION/somefile*.utf.gz | tail -1`
**{I want to check if Latest file is valid. If Yes proceed further, if not exit}**
python mycode.py $LATEST_FILE
命令在目录中获取最新文件并将其存储在变量中,然后根据它运行其余代码。
这是我的代码:
if [$LATEST_FILE = ""]
then
echo "FIle does not exists"
exit 0
fi
我试过了:
./script.sh[5]: [somefile123.utf.gz: not found [No such file or directory]
如果文件不存在,这可以正常工作。但如果该文件存在,则会抛出此错误:
Criteria criteriaz = session.createCriteria(Organisation.class);
final List<Organisation> orgList = criteriaz.list();
BeanItemContainer<Organisation> srcOrgs = new BeanItemContainer<Organisation>(Organisation.class);
srcOrgs.addAll(orgList);
organisationId.setInvalidAllowed(false);
organisationId.setNullSelectionAllowed(false);
organisationId.setContainerDataSource(srcOrgs);
organisationId.setItemCaptionMode(ItemCaptionMode.PROPERTY);
organisationId.setItemCaptionPropertyId("name");
for (Organisation mOrg : orgList) {
if (mOrg.getRowid().equals(activity.getOrganisationId()))
mOrgID = mOrg.getName();
}
organisationId.select(mOrgID);
请帮助我。
答案 0 :(得分:1)
您缺少两个空格和引号:
if [ "$LATEST_FILE" = "" ]