社区
Linux/Unix社区
帖子详情
shell下如何实现and,or,not(在线等,对的马上给分)
feilong816
2004-06-22 12:53:51
if [ -r temp1.sh ]
if [ -r temp2.sh ]
现在我要将这两个用and,or,not实现
if [ -r temp1.sh -r temp2.sh ]
如何实现
谢谢
...全文
2010
7
打赏
收藏
shell下如何实现and,or,not(在线等,对的马上给分)
if [ -r temp1.sh ] if [ -r temp2.sh ] 现在我要将这两个用and,or,not实现 if [ -r temp1.sh -r temp2.sh ] 如何实现 谢谢
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
feilong816
2004-06-22
打赏
举报
回复
对了,谢谢
不过并非需要绝对路径
if [ -r temp1.sh ] && [ -r temp2.sh ];then
echo "found"
else
echo "not found"
fi
结果
not found
或者
found
liqingh
2004-06-22
打赏
举报
回复
你写的没错,是两个文件没找到,你把temp1.sh和temp2.sh写成相对路径或绝对路径
feilong816
2004-06-22
打赏
举报
回复
写个完整的代码,如
if [ -r temp1.sh ];then
echo "right"
fi
写成
if [ -r temp1.sh ] && [ -r temp2.sh ];then
echo "right"
fi
只要实现if判断就行了,但要同时符合两个条件
liqingh
2004-06-22
打赏
举报
回复
不明白的你问什么?
feilong816
2004-06-22
打赏
举报
回复
是不是有问题,没有通过,正常的语句是这样的
if [ -r temp1.sh ];then
echo "right"
fi
如果你觉得有问题的话,请把代码写完整,谢谢
liqingh
2004-06-22
打赏
举报
回复
if [ ! $n = 0 ] && [ ! $m = 0 ]
liqingh
2004-06-22
打赏
举报
回复
if [ ! $n = 0 ] || [ ! $m = 0 ]
Linux命令:grep命令AND、OR、NOT实例
在grep中,我们有相当于OR和NOT运算符的选项,但没有AND运算符。但是,我们可以使用模式来模拟AND。在本文的例子将有助于理解如何使用grep命令的OR, AND和NOT运算进行文本的搜索。 本文将使用下面的employee.txt...
Linux
Shell
下条件语句:
Linux
Shell
下条件语句: 1、 测试字符串之间的关系 bash把所有的命令行和变量都看作字符串。一些命令如expr和test可以把字符当作数字进行操作。同样任何数字也可以作为字符串进行操作。 用户可以比较两个字符...
CommandNotFoundError: Your
shell
has not been properly configured to use ‘conda activate‘.
CommandNotFoundError: Your
shell
has not been properly configured to use 'conda activate'. To initialize your
shell
, run $ conda init <
SHELL
_NAME> Currently supported
shell
s
shell
脚本
实现
逻辑关系与、或、非
shell
脚本
实现
逻辑关系与、或、非
解决CommandNotFoundError: Your
shell
has not been properly configured to use ‘conda activate’
CommandNotFoundError: Your
shell
has not been properly configured to use 'conda activate'. To initialize your
shell
, run $ conda init <
SHELL
_NAME> Currently supported
shell
s are: - bash - ...
Linux/Unix社区
23,222
社区成员
74,538
社区内容
发帖
与我相关
我的任务
Linux/Unix社区
Linux/Unix社区 应用程序开发区
复制链接
扫一扫
分享
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章