惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

W
WeLiveSecurity
T
The Exploit Database - CXSecurity.com
C
CXSECURITY Database RSS Feed - CXSecurity.com
S
Security @ Cisco Blogs
T
Threat Research - Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
腾讯CDC
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
T
The Blog of Author Tim Ferriss
Microsoft Azure Blog
Microsoft Azure Blog
罗磊的独立博客
F
Full Disclosure
博客园 - 【当耐特】
C
CERT Recently Published Vulnerability Notes
Engineering at Meta
Engineering at Meta
Application and Cybersecurity Blog
Application and Cybersecurity Blog
T
Threatpost
I
Intezer
V2EX - 技术
V2EX - 技术
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Hacker News
The Hacker News
小众软件
小众软件
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
B
Blog RSS Feed
Microsoft Security Blog
Microsoft Security Blog
N
News | PayPal Newsroom
MyScale Blog
MyScale Blog
AI
AI
Vercel News
Vercel News
Spread Privacy
Spread Privacy
美团技术团队
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
The GitHub Blog
The GitHub Blog
V
Vulnerabilities – Threatpost
Schneier on Security
Schneier on Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
L
LINUX DO - 热门话题
U
Unit 42
L
LangChain Blog
Recent Announcements
Recent Announcements

博客园 - 番茄的梦想

Debian防火墙的ufw的使用 Linux—nvm教程 LNMP一键安装包安装的mysql远程连接不上的问题 linux service文件格式 微软sdk及运行时下载地址 解决python错误 UnicodeDecodeError: 'gb2312' codec can't decode byte 0x8b in position 1: illegal multibyt pip相关介绍 结构(位置)伪类选择器 如何清除mstsc记录 ubuntu开启远程桌面功能 使用Windows远程桌面工具来远程连接控制Ubuntu系统 缓存头Cache-Control的含义和使用 正则表达式 以A开头B结尾 取中间的内容 nginx 不带www的域名跳转www域名 IIS配置导入导出 CSS中hover选择器的使用详解 html 锚点三种实现方法 重置自增长id 如何解决Visual Studio2012 与此版本的Windows不兼容
linux if命令
番茄的梦想 · 2023-09-13 · via 博客园 - 番茄的梦想

关于文件属性的判断式

-a 如果文件存在

-b 如果文件存在,且该文件是区域设备文件

-c 当file存在并且是字符设备文件时返回真

-d 当pathname存在并且是一个目录时返回真

-e 当pathname指定的文件或目录存在时返回真

-f 当file存在并且是普通文件时返回真

-g 当由pathname指定的文件或目录存在并且设置了SGID位时返回为真

-h 当file存在并且是符号链接文件时返回真,该选项在一些老系统上无效

-k 当由pathname指定的文件或目录存在并且设置了“sticky”位时返回真

-r 当由pathname指定的文件或目录存在并且可读时返回为真

-s 当file存在文件大小大于0时返回真

-t 文件描述符   如果文件描述符是开启的,且链接了某一个终端

-u 当由pathname指定的文件或目录存在并且设置了SUID位时返回真

-w 当由pathname指定的文件或目录存在并且可执行时返回真。一个目录为了它的内容被访问必然是可执行的。

-x  如果文件存在,且该文件有可执行的属性

-O 当由pathname指定的文件或目录存在并且被子当前进程的有效用户ID所指定的用户拥有时返回真。

-G  如果文件存在,且该文件为有效的群组 id 所拥有

-L  如果该文件存在,且该文件是符号链接文件

-S  如果该文件存在,且该文件是Socket文件

-N  如果该文件存在,且该文件自上次读取后曾修改过

文件1   –nt  文件2   如果文件1比文件2新,或者文件1存在,文件2不存在

文件1   –ot  文件2   如果文件1比文件2旧,或者文件1不存在,文件2存在

文件1   –ef  文件2   如果文件1和文件2 引用到相同的设备和 inode 编号

关于字符串的条件判断式

-z                                           空串 (如果字符串长度为0)

-n                                           非空串 (如果字符串长度不为0)

字符串                                       如果字符串长度不为0

!=                                           如果两个字符串不相等                   

=                                           如果两个字符串相等

==                                          如果两个字符串相等

字符串 1 < 字符串      2            如果字符串1小于字符串2

字符串 1 > 字符串      2            如果字符串1大于字符串2

关于算式的条件判断

-eq   等于

-ne    不等于

-gt    大于

-lt    小于

-le    小于等于

-ge   大于等于

关于 Bash 选项的条件判断

-o set的选项名称         如果选项是开启的状态