【Bash百宝箱】shell内建命令之help、type、let、logout
来源:互联网 发布:行列互换编程 编辑:程序博客网 时间:2024/06/01 10:05
1、help
在shell中,内建(builtin)命令help,格式如下:
help [-dms] [pattern]
help命令用于显示shell内建命令的帮助信息,如果指定了模式pattern,则只显示与模式匹配的命令的帮助信息,否则显示全部内建命令的帮助信息。选项“-d”用于显示命令的一个简短描述,“-m”以man page的格式来打印命令描述,否则以默认格式打印,“-s”用于显示命令的语法格式。
下面以help命令查看help命令本身:
$ help -d helphelp - Display information about builtin commands.$ help -s helphelp: help [-dms] [pattern ...]$ help -m helpNAME help - Display information about builtin commands.SYNOPSIS help [-dms] [pattern ...]DESCRIPTION Display information about builtin commands. Displays brief summaries of builtin commands. If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise the list of help topics is printed. Options: -d output short description for each topic -m display usage in pseudo-manpage format -s output only a short usage synopsis for each topic matching PATTERN Arguments: PATTERN Pattern specifiying a help topic Exit Status: Returns success unless PATTERN is not found or an invalid option is given.SEE ALSO bash(1)IMPLEMENTATION GNU bash, version 4.3.46(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
2、type
在shell中,内建(builtin)命令type,格式如下:
type [-aftpP] name [name ...]
type命令用于查找shell命令name的类型。选项“-t”用于显示name的类型,包括别名alias、shell保留字keyword、函数function、内建builtin和磁盘文件file。对于磁盘文件file来说,选项“-p”可显示命令name指定的磁盘文件名。选项“-P”强制在环境变量PATH中搜索命令name。如果多个地方都包括命令name,使用选项”-a“可以把它们全部打印出来,否则只显示第一个。选项”-f“的作用是试图不在函数和内建命令中查找name。
下面是type命令的几个用法:
$ type typetype is a shell builtin$ type -t typebuiltin$ type pwdpwd is a shell builtin$ type -t pwdbuiltin$ type -a pwdpwd is a shell builtinpwd is /bin/pwd$ type -t topfile$ type toptop is /usr/bin/top$ foo() { echo "function foo"; }$ type foofoo is a functionfoo () { echo "function foo"}$ type -t foofunction
3、let
在shell中,内建(builtin)命令let,格式如下:
let arg [arg ...]
let命令用于对数学表达式arg求值,例子如下:
$ a=1$ b=2$ c=$a+$b$ echo $c1+2$ let d=$a+$b$ echo $d3
4、logout
在shell中,内建(builtin)命令logout用于退出登录shell。在Linux中,shell分为登录login和非登录nonlogin两种,登录shell如常用的”/bin/bash“,非登录shell如”/usr/sbin/nologin“,登录shell是用户可以登录使用的,登录以后可以与计算机交互,非登录shell则没有这个功能,但有其特殊用途,Linux上各用户的shell默认登录状态可查看文件”/etc/passwd“。
- 【Bash百宝箱】shell内建命令之help、type、let、logout
- 【Bash百宝箱】shell内建命令之冒号
- 【Bash百宝箱】shell内建命令之句点与source
- 【Bash百宝箱】shell内建命令之break与continue
- 【Bash百宝箱】shell内建命令之cd、getopts
- 【Bash百宝箱】shell内建命令之hash
- 【Bash百宝箱】shell内建命令之times、umask、unset
- 【Bash百宝箱】shell内建命令之test
- 【Bash百宝箱】shell内建命令之trap
- 【Bash百宝箱】shell内建命令之alias与unalias
- 【Bash百宝箱】shell内建命令之builtin、command、caller
- 【Bash百宝箱】shell内建命令之declare、typeset、local
- 【Bash百宝箱】shell内建命令之echo、printf
- 【Bash百宝箱】shell内建命令之read、readarray、mapfile
- 【Bash百宝箱】shell内建命令之bind、enable、ulimit
- 【Bash百宝箱】shell内建命令之set、shopt
- 【Bash百宝箱】shell内建命令之echo、printf
- 【Bash百宝箱】shell内建命令之eval、exec、exit、export
- Spring 整合HornetQ的JMS整合(Jboss服务器)
- 正则表达式中的捕获和非捕获
- iOS开发-SDWebImage的回调不addSubView不会调用
- 99%的人都理解错了HTTP中GET与POST的区别
- VC添加ESXi异常datacenter.queryconnectioninfo
- 【Bash百宝箱】shell内建命令之help、type、let、logout
- 新生活
- 使用ASP.Net WebAPI构建REST服务(一)——简单的示例
- Linux 挂载硬盘
- git .ssh 公钥
- 寻找和为Sum的多个数-1
- Java之简单输入输出数据
- recycleView scrollToPosition 现象
- 多进程编程之进程间通信-管道和消息队列