shell中expr强大功能(1)

简介:
EXPR(1)                          User Commands                         EXPR(1)

NAME
       expr - evaluate expressions

SYNOPSIS
       expr EXPRESSION
       expr OPTION

DESCRIPTION
       --help display this help and exit

       --version
              output version information and exit

       Print  the  value of EXPRESSION to standard output.  A blank line below
       separates increasing precedence groups.  EXPRESSION may be:

       ARG1 | ARG2
              ARG1 if it is neither null nor 0, otherwise ARG2

       ARG1 & ARG2
              ARG1 if neither argument is null or 0, otherwise 0

       ARG1 < ARG2
              ARG1 is less than ARG2

       ARG1 <= ARG2
              ARG1 is less than or equal to ARG2

       ARG1 = ARG2
              ARG1 is equal to ARG2

       ARG1 != ARG2
              ARG1 is unequal to ARG2

       ARG1 >= ARG2
              ARG1 is greater than or equal to ARG2

       ARG1 > ARG2
              ARG1 is greater than ARG2

       ARG1 + ARG2
              arithmetic sum of ARG1 and ARG2

       ARG1 - ARG2
              arithmetic difference of ARG1 and ARG2

       ARG1 * ARG2
              arithmetic product of ARG1 and ARG2

       ARG1 / ARG2
              arithmetic quotient of ARG1 divided by ARG2

       ARG1 % ARG2
              arithmetic remainder of ARG1 divided by ARG2

       STRING : REGEXP
              anchored pattern match of REGEXP in STRING

       match STRING REGEXP
              same as STRING : REGEXP

       substr STRING POS LENGTH
              substring of STRING, POS counted from 1


       substr STRING POS LENGTH
              substring of STRING, POS counted from 1

       index STRING CHARS
              index in STRING where any CHARS is found, or 0

       length STRING
              length of STRING

       + TOKEN
              interpret TOKEN as a string, even if it is a

              keyword like `match' or an operator like `/'

       ( EXPRESSION )
              value of EXPRESSION

       Beware that many operators need to be escaped  or  quoted  for  shells.
       Comparisons are arithmetic if both ARGs are numbers, else lexicographi‐
       cal.  Pattern matches return the string matched between and  or
       null;  if  and are not used, they return the number of characters
       matched or 0.

       Exit status is 0 if EXPRESSION is neither null nor 0, 1  if  EXPRESSION
       is  null  or  0,  2 if EXPRESSION is syntactically invalid, and 3 if an
       error occurred.

AUTHOR
       Written by Mike Parker, James Youngman, and Paul Eggert.

REPORTING BUGS
       Report expr bugs to bug-coreutils@gnu.org
       GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
       General help using GNU software: <http://www.gnu.org/gethelp/>
       Report expr translation bugs to <http://translationproject.org/team/>

COPYRIGHT
       Copyright © 2010 Free Software Foundation, Inc.   License  GPLv3+:  GNU
       GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
       This  is  free  software:  you  are free to change and redistribute it.
       There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       The full documentation for expr is maintained as a Texinfo manual.   If
       the  info  and  expr  programs are properly installed at your site, the
       command

              info coreutils 'expr invocation'

       should give you access to the complete manual.

GNU coreutils 8.5                February 2011                         EXPR(1)

 Manual page expr(1) line 63/109 (END)



本文转自 天涯飞客 51CTO博客,原文链接:http://blog.51cto.com/425093014/1062324,如需转载请自行联系原作者

目录
打赏
0
0
0
0
265
分享
相关文章
|
11月前
|
【Shell 命令集合 磁盘管理 】Linux 关闭磁盘配额功能 quotaoff命令使用教程
【Shell 命令集合 磁盘管理 】Linux 关闭磁盘配额功能 quotaoff命令使用教程
127 1
|
11月前
|
【Shell 命令集合 磁盘管理 】Linux 启用指定文件系统上的磁盘配额功能 quotaon 命令使用教程
【Shell 命令集合 磁盘管理 】Linux 启用指定文件系统上的磁盘配额功能 quotaon 命令使用教程
122 1
|
3月前
|
解决 Ubuntu 用户登录后的 shell 和功能问题
通过本文的详细介绍,您可以掌握解决Ubuntu用户登录后shell和功能问题的方法,从而确保系统的稳定和正常使用。
159 29
使用shell脚本实现自动SSH互信功能
使用shell脚本实现自动SSH互信功能
128 1
|
8月前
|
WPF与Windows Shell完美融合:深入解析文件系统操作技巧——从基本文件管理到高级Shell功能调用,全面掌握WPF中的文件处理艺术
【8月更文挑战第31天】Windows Presentation Foundation (WPF) 是 .NET Framework 的关键组件,用于构建 Windows 桌面应用程序。WPF 提供了丰富的功能来创建美观且功能强大的用户界面。本文通过问题解答的形式,探讨了如何在 WPF 应用中集成 Windows Shell 功能,并通过具体示例代码展示了文件系统的操作方法,包括列出目录下的所有文件、创建和删除文件、移动和复制文件以及打开文件夹或文件等。
179 0
|
11月前
|
【Shell 命令集合 系统设置 】Linux 显示或设置键盘按键与其相关的功能 bind命令 使用指南
【Shell 命令集合 系统设置 】Linux 显示或设置键盘按键与其相关的功能 bind命令 使用指南
131 0
|
11月前
|
【Shell 命令集合 文档编辑】Linux 种算术运算 expr命令使用指南
【Shell 命令集合 文档编辑】Linux 种算术运算 expr命令使用指南
129 0
Java调用shell脚本实现数据库备份功能
本篇文章主要介绍怎样使用Java程序,执行服务器上的数据库备份Shell脚本进行MySQL数据库的备份功能。
百度搜索:蓝易云【Shell脚本实现Mysql持续kill功能】
将以上代码保存为一个名为 `kill_mysql.sh`的文件,并确保该文件具有执行权限(可以使用 `chmod +x kill_mysql.sh`命令赋予执行权限)。然后在终端中运行该脚本即可实现MySQL的持续kill功能。
90 0
shell脚本确定目的和功能详情
shell脚本确定目的和功能详情
88 1