特殊Bash变量

Posted by 4Aiur on 03/31/2010 in Shell |

特殊Bash变量

字符 定义
$* 展开为位置参数,从1开始。当扩展发生在双引号时,它展开成一个单独的词,每个参数的值由 IFS 特殊变量的第一个字符分隔。
$@ 展开为位置参数,从1开始。当在双引号里展开时,每个参数展开成独立的词。
$# 把位置参数展开为十进制数字。
$? 展开成最近执行的前台管道程序的退出状态。
$- 一个连字符展开为当前选项标志 内部命令集 或者那些shell自己的集(如-i)。A hyphen expands to the current option flags as specified upon invocation, by the set built-in command, or those set by the shell itself (such as the -i).
$ 展开成shell的进程ID。
$! 展开成最近在后台(异步)执行的命令的进程ID。
$0 展开成shell或者shell脚本名。
$_ 下划线变量在shell启动时设置,包含shell的绝对文件名或者作为参数列表被执行的脚本。随后,它展开为前一个命令扩展后的最后一个参数。它同样设置为每个执行程序的全路径,放在那个命令的输出环境中。当检查邮件时,这个参数保存邮件文件的名字。The underscore variable is set at shell startup and contains the absolute file name of the shell or script being executed as passed in the argument list. Subsequently, it expands to the last argument to the previous command, after expansion. It is also set to the full pathname of each command executed and placed in the environment exported to that command.

Tags:

Copyright © 2010-2024 4Aiur All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.