文章出處

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 

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“。

就愛閱讀www.92to.com網友整理上傳,為您提供最全的知識大全,期待您的分享,轉載請注明出處。
歡迎轉載:http://www.kanwencang.com/bangong/20161206/63558.html

文章列表


不含病毒。www.avast.com
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()