if语句中的多个一元运算符 [英] Multiple unary operators in an if statement

查看:117
本文介绍了if语句中的多个一元运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在if语句中是否可以有多个一元运算符.这是给我错误的代码段.

Is it possible to have multiple unary operators in if statements.. Here is the code snippet which is giving me error.

请在此处更正代码.

if [ -f $input_file ] -a [ -f $output_file ] -a [ -f $log_file ] ]
then
    ### Some Code here
fi

推荐答案

if [ -f "file1" -a -f "file2" -a "file3" ]; then
   #some code
fi

这篇关于if语句中的多个一元运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆