关于显示在dw中显示当前系统日期和时间,并可修改,读取等...

kernel1_0 2002-11-03 10:10:20
做一个酒店管理系统...要读入住时间,表里要有日期时间这个字段啊....
可是怎么取系统时间那...而且还可以修改的....有滑动按钮的最好啦...
好像有这么个函数或控件的...
没头绪那...请指点一下..说说如何才能很好的实现这个功能啊...就是不用用户填,可以选时间日期的....不论什么提议都可以啊....
...全文
608 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
nettang 2002-11-04
  • 打赏
  • 举报
回复
you you yi dian dian ben yao
winwhere 2002-11-03
  • 打赏
  • 举报
回复
在数据库字段的初始值里填上 getdate()
txchen 2002-11-03
  • 打赏
  • 举报
回复
在数据库里建一个视图,写上SQL语句:
select getdate() nowdate

然后在PB里调用这个视图不就可以了吗?
txchen 2002-11-03
  • 打赏
  • 举报
回复
这样试试吧,在建数据窗口对对象时,在数据源中写上
select filed1,filed2,......,getdate() as nowdate from table1 where ......
如果语法没问题的话,这样就把系统时间当字段来处理,那在数据窗口中就可以编辑了.
alone1998 2002-11-03
  • 打赏
  • 举报
回复
如果后台数据库是用的SQL server,在server里有个系统存储过程getdate,执行这个存储过程:
datetime ld_01
execute sp_getdate @date=ld_01 OUTPUT;
ld_01就是数据库系统时间.如果不是SQL server 用API函数可以得到系统时间
kernel1_0 2002-11-03
  • 打赏
  • 举报
回复
我pb6.5好像没getdate()这个函数哦...
xwmhn 2002-11-03
  • 打赏
  • 举报
回复
对,同意楼上的说的,你用getdate()可以实现的
suziniren 2002-11-03
  • 打赏
  • 举报
回复
同意zhanwei(@_@,最近很忙) 的方式

zhanwei 2002-11-03
  • 打赏
  • 举报
回复
如上面两位,再改一下编辑方式
用户手册 RAR 4.00 控制台版本 欢迎使用 RAR 压缩文件管理器! 简介 RAR 是一个强力压缩工具,允许你管理和操作压缩文件。控制台 RAR 只支持 RAR 格式,带有的 ".rar" 扩展名的文件。ZIP 和其他格式不被支持。Windows 用户可以 安装图形界面 RAR 版本 - WinRAR,它可以处理更多的压缩文件类型。 RAR 的功能包括: * 高度成熟的原创压缩算法 * 对于文本、声音、图像和 32 位和 64 位 Intel 可执行程序压缩的特殊优化算法 * 获得比类似工具更好的压缩率,使用'固实'压缩 * 身份校验(只有注册版本可用) * 自解压压缩文件和分卷压缩(SFX) * 对物理损伤的压缩文件的恢复能力 * 锁定,密码,文件顺序列表,文件安全和更多 配置文件 Unix 版本的 RAR 从用户的 home 或 /etc 目录的 .rarrc 文件读取配置文件信息 (存储在 HOME 环境变量) Windows 的版本 RAR 从 rar.ini 文件读取配置文件信息,它放在 rar.exe 文件相 同的目录。 这个文件包含下列字符串: switches=任何 RAR 开关,用空格分开 例如: switches=-m5 -s 环境变量 可以通过建立"RAR"环境变量来添加默认参数到命令行. 例如,在 UNIX ,下列命令行可以被添加到你的配置: RAR='-s -md1024' export RAR RAR 将使用这个字符串作为命令行的默认参数,并将使用 1024KB 字典大小来创建 “固实”压缩文件。 RAR 控制选项使用下列优先级: 命名行开关 最高优先级 在 RAR 变量的开关 低优先级 保存在配置文件的开关 最低优先级 日志文件 如果在命令行或配置文件指定开关 -ilog ,RAR 将会把处理压缩文件遇到的错误 等写到日志文件读取开关 -ilog 描述获得更多信息。 固实压缩的文件列表 - rarfiles.lst rarfiles.lst 包含一个用户定义的文件列表,告诉 RAR 添加文件到固实压缩文件时的顺 序。它可以包含文件名通配符和指定项目 -$default。默认项目定义了这个文件与 其他项目不相符时的顺序清单位置。 注释字符是 ';'. 在 Windows ,这个文件应该放在 RAR 所在的或 %APPDATA%\WinRAR 目录, 在 Unix - 放在用户的 home 目录或在 /etc 。 提高压缩率和操作速度的提示: - 在压缩文件,小文件应该被组织在一起; - 频繁被处理的文件应该放在开始的位置。 普通的掩码越靠近顶端优先权就越高,但是这个规则存在例外。如果 rarfiles.lst 包含两个掩码,并且所有文件既匹配第一个掩码,也匹配第二个掩码, 较小的子集 或者更精确的匹配拥有更高的优先权。例如,如果你用 *.cpp 和 f*.cpp 掩码, f*.cpp 拥有更高的优先权。 RAR 命令行语法 ~~~~~~~~~~~~~~ 语法 RAR <命令> [ -<开关> ] <压缩文件> [ <@列表文件...> ] [ <文件...> ] [ <解压路径\> ] 描述 命令行选项 (命令和开关) 提供了使用 RAR 创建和管理压缩文件的控制方法。命 令是一个字符串(或单个的字母),命令 RAR 去执行一个相应的操作。开关被用来 改变 RAR 执行操作的方法。其它参数是压缩文件名和被压缩的文件或要从压缩文件 被解压文件。 列表文件是一个包括处理的文件名的纯文本文件。第一列应该以文件名开始。可以 在//字符后添加注释。例如,你可以创建包含下列字符串的 backup.lst: c:\work\doc\*.txt //备份文本文档 c:\work\image\*.bmp //备份图片 c:\work\misc 接着运行: rar a backup @backup.lst 如果你希望从标准输入设备读取文件名,指定空的文件列表名(只有@)。 在列表文件 Win32 控制台 RAR 使用 OEM (DOS) 编码。 你可以在同一命令行指定普通文件名和列表文件。如果文件和列表 文件都未被指定,那么 RAR 将默认是 *.*,来处理所有文件 在一个 UNIX 环境变量,你需要将通配符置于引号,避免被外壳扩展。例如, 这个命令将从当前路径的 RAR 压缩文件解压所有的 *.asm 文件: rar e '*.rar' '*.asm' 命令可以是下列的任何一个: a 添加文件到压缩文件。 例子: 1) 从当前目录添加所有的 *.hlp 文件到 help.rar 压缩文件: rar a help *.hlp 2) 把当前目录和子目录的所有文件压缩为 362000 字节大小、固实的、 自解压分卷压缩文件并对没个卷添加恢复记录: rar a -r -v362 -s -sfx -rr save 因为尾指定文件名,假设为所有文件 (*)。 3) 作为一个特别的例外,如果目录名被作为参数指定并且目录名不包 含文件掩码和以反斜线结尾,即使指定了 -r 开关,目录和子目录的所 有内容都会被添加到压缩文件。 下面的命令会把 Bitmaps 目录和它的子目录的所有文件添加到 RAR 压缩文件 Pictures.rar : rar a Pictures.rar Bitmaps 4) 如果目录包含文件掩码或以反斜线结尾,将会应用普通的规则,你 需要指定 -r 开关来处理它的子目录。 下列命令会把 Bitmaps 目录除了子目录外的所有文件添加,因为未 指定开关 -r: rar a Pictures.rar Bitmaps\* c 添加压缩文件注释。当压缩文件被处理时注释被显示。文件的注释长度限 制到 32767 字节 例子: rar c distrib.rar 注释也可以使用 -z[名称] 开关从文件添加: 下列命令从 info.txt 文件添加一个注释: rar c -zinfo.txt dummy cf 添加文件注释。当使用'v'命令时显示文件注释。文件的注释长度限制到 32767 字节。 例子: rar cf bigarch *.txt ch 改变压缩文件参数。 此命令能和大多数压缩文件变量开关一起使用修改压缩文件参数。对于象 -av, -cl, -cu, -tl 等没有专门命令的开关特别方便。 它不能重新压缩、解密或加密压缩文件数据,它不能整合或创建卷。如果 不和其它开关一起使用,'ch' 命令仅复制压缩文件数据而不修改它。 例如: 设置压缩文件时间为最新的文件: rar ch -tl files.rar cw 写压缩文件注释到指定文件。 输出文件格式依赖于 -sc 开关。 如果输出文件名没有指定,注释数据会被发送到标准输出设备。 例子: 1) rar cw oldarch comment.txt 2) rar cw -scuc arc unicode.txt 3) rar cw arc d 从压缩文件删除文件。请注意,如果这个命令导致压缩文件所有文件 全部删除,这个空的压缩文件将被删除。 e 解压文件到当前目录。 f 更新压缩文件的文件。 更新打包到压缩文件后被改变的文件。这个命令不 向压缩文件添加新文件。 i[i|c|h|t]=<字符串> 在压缩文件查找字符串。 支持下列可选参数: i - 不区分大小写(默认); c - 区分大小写搜索; h - 十六进制搜索; t - 使用 ANSI, Unicode 和 OEM 字符表 (只有 Win32 可用); 如果没有指定任何参数,它可以使用简化的命令行语法 i<字符串> 来代 替 i=<字符串> 它允许指定带有另外一个参数的 't' 变量,例如,ict=字符串 在上面提 及的所有表执行区分大小写的搜索。 例子: 1) rar "ic=first level" -r c:\*.rar *.txt 在 c:\*.rar 压缩文件的 *.txt 文件执行区分大小写的 "first level" 字符串的搜索 2) rar ih=f0e0aeaeab2d83e3a9 -r e:\text 在 e:\text 目录下的 rar 压缩文件搜索十六进制字符串 f0 e0 ae ae ab 2d 83 e3 a9。 k 锁定压缩文件。任何试图改变压缩文件的命令都会被忽略。 例子: rar k final.rar l[t,b] 压缩文件的内容列表[技术信息]。和 'v' 命令一样列出文件,但不包括 文件路径。也就是只显示文件名。当使用't'变量时可选技术信息(主操作 系统,固实标志和老版本标记)被显示。变量 'b' 强制 RAR 只输出单纯 的文件名,而没有其他任何的附加信息。 m[f] 移动到压缩文件[只用于文件]。移动文件和目录会使压缩操作完成后它 们被删除。如果使用变量'f'和/或应用开关'-ed',则不删除目录。 p 打印文件到标准输出设备。 你可以把这个命令和 -inul 开关一起使用来禁止所有的 RAR 信息,并只 打印文件数据。当你需要发送一个文件到标准输出设备时,这也许很重要。 r 修复压缩文件。压缩文件修复是在两阶段完成的。首先,在损坏的压缩 文件查找恢复记录(参照'rr'命令)。如果压缩文件包含恢复记录,并且 损坏数据部分是连续的,而且少于N*512字节(N 处是放入压缩文件恢复块 的数字),则成功恢复压缩文件的机会非常高。当这个阶段完成,一个新的 压缩文件将被创建,名为_RECOVER.RAR。 如果损坏的压缩文件不包含恢复记录或如果压缩文件没有完全恢复导致大 的损伤,将执行第二阶段。这一阶段期间只重建压缩文件的结构,而不可 能恢复 CRC 校验失败的文件。它仍然可能恢复未受损的文件,因文件结 构破坏。这对于非固实压缩文件通常有用。 当第二阶段完成,重建结构的压缩文件将被保存为 rebuilt.arcname.rar, 'arcname' 的位置是原始压缩文件名。 RAR/DOS32 版本使用 _recover.rar 和 _reconst.rar 而不是上面提及的 名字。 在恢复记录进行,当发现可疑文件时,RAR 可以提示用户。 可疑项目 名字: <可能的文件名> 大小: <大小> 压缩后: <压缩后大小> 添加它: 是/否/全部 回答 'y' 把这个项目添加到文件 rebuilt.arcname.rar 。 例子: rar r buggy.rar rc 使用恢复卷(.rev 文件)重建丢失的卷。你需要指定任何已存在的卷作为 压缩文件名,例如,'rar rc backup.part03.rar' 读取 'rv' 命令描述得到关于恢复卷的信息。 rn 重命名压缩文件。 命令语法是: rar rn <压缩文件名> <源文件名1> <目标文件名1> ... <源文件名N> <目 标文件名N> 例如,下列命令: rar rn data.rar readme.txt readme.bak info.txt info.bak 在压缩文件 data.rar 将把 readme.txt 重命名为 readme.bak 并把 info.txt 重命名为 info.bak。 在源文件和目标文件名可以使用通配符来进行简单像改变文件扩展名的名 称转换。例如: rar rn data.rar *.txt *.bak 将把所有的 *.txt 文件重命名为 *.bak。 RAR 不检查目标文件名是否已经在压缩文件存在,所以你需要小心,防止 重名。尤其是使用通配符时特别重要。这个命令有潜在的危险,因为一个错 误的通配符可以损坏所有的压缩文件名。 rr[N] 添加数据恢复记录。可选,多余信息(恢复记录)可以被添加到压缩文件 。这将导致压缩文件大小稍微增加,但能在软盘错误或其它数据丢失 情况下帮助恢复压缩文件。一个恢复记录最大包含 524288 个恢复块。 块的数目可以在'rr'(N = 1,2 .. 524288)命令直接指定或不用用户 指定,而是根据压缩文件的大小自动设定:一个恢复信息大小大约是总 压缩文件大小的1%,通常允许恢复达到压缩文件总大小的0.6%的连续数 据。 也可以以压缩文件大小的百分比来指定恢复记录的大小。只要把%添加到 命令参数后。 例如: rar rr3% arcname 注意,如果你从.bat 或 .cmd文件运行这个命令时,你需要使用rr3%%代 替rr3%,因为批处理命令把符号'%'作为批处理文件开始的参数。你可以 使用 'p' 代替'%',所以'rr3p'也可运行。 如果受损的数据是连续性的,则每个恢复记录块帮助恢复损坏信息的512 字节。如果多处损坏这个值将降低。 恢复记录的大小可以使用公式<压缩文件大小>/256 + <恢复记录数>*512 字节估计。 rv[N] 创建恢复卷(.rev文件),以后它可以用于重建卷组丢失的文件。这个命 令只对多卷压缩文件敏感,你需要在组指定第一个分卷文件的文件名。 例如: rar rv3 data.part01.rar 这个功能可以被用来备份,例如,发送一个多卷压缩文件到一个新组,并 且部分接收者没有收其的一些文件。重新发送恢复卷代替普通卷,可以 减少传送文件的总数。 每个恢复卷可以重建一个丢失的 RAR 卷。例如,如果你有30个卷,3个恢 复卷,你可以创建任何3个丢失的卷。如果.rev文件的数目少于丢失卷的 数目,重建将不可能。普通和恢复卷的总数不能超过255。 原来的 RAR 卷在卷被创建后不能被修改。修复算法使用存储在 REV 文件 和 RAR 卷的数据来重建丢失的 RAR 卷。所有如果你修改了 RAR 卷, 例如,在创建 REV 文件后锁定它们,修复操作将失败。 选项 参数指定创建恢复卷的数目,必须少于RAR卷的总数。你也可以 附加一个百分号到这个参数上,这样创建的.rev文件的数目将等于从 RAR 卷总数获得的这个百分比。 例如: rar rv15% data.part01.rar RAR 不管是使用‘rc’命令或自动时,如果在解压时无法定位下一卷,并 且发现可用数目的 .rev 文件,对丢失的卷和损坏的卷都试图重建。 损坏卷的原始副本在被重建前重命名为 *.bad。例如,volname.part03.rar 将被重命名为volname.part03.rar.bad。 s[名称] 转换压缩文件成自解压格式。压缩文件和自解压模块合并(使用 default.sfx模块或在开关指定)。在 Windows 版本 default.sfx 应 该放在RAR.exe 所在目录下,在 Unix 在用户的 home 目录,在 /usr/lib 或 /usr/local/lib 下。 s- 从已存在的自解压压缩文件删除自解压模块。RAR 创建一个不带自解压 模块的新的压缩文件,原来的自解压文件不会被删除。 t 测试压缩文件。为了验证指定的文件,这个命令执行虚拟的文件解压操作, 不写出任何输出数据流。 例子: 在当前目录测试压缩文件: 或对于 Unix: rar t '*' 当前目录开始,测试所有子目录下的压缩包: rar t -r * 或对于 Unix: rar t -r '*' u 更新压缩文件的文件。添加不在压缩文件的文件和更新打包后改变了的 文件。 v[t,b] 详细列出压缩文件内容[技术信息]。文件列出所使用的格式:绝对路径名,文 件注释,原始和压缩后的大小,压缩率,最近更新日期时间,属性,CRC, 压缩方式和解压所需的最小RAR版本。当使用't'变量时可选技术信息(主操作 系统,固实标志和老的文件版本标记)显示。变量 'b' 强制 RAR 只输出单纯 的文件名,而没有其他任何的附加信息。 列出所有压缩卷的内容,使用星号('*')代替压缩文件扩展名或使用'-v' 开关。 例子: 1) 列出 system.rar 压缩文件的内容 (技术信息)并使用重定向符输出 到文件 techlist.lst rar vt system >techlist.lst 2) 列出 tutorial.rar 压缩文件的内容 (单纯文件名模式) rar vb tutorial x 带绝对路径解压 例子: rar x -av- -c- dime 10cents.txt 解压指定的文件到当前路径。AV 检查和注释显示被禁用。 开关 (与命令结合使用): -? 显示命令和开关的帮助。和没有参数或输入非法命令行选项时相同。 -- 停止开关扫描 这个开关告诉 RAR 命令行没有更多的开关了。如果压缩文件或文件名 以 - 符号开头,可以使用它。没有'--'开关,这样的名字将被作为开关 对待。 例子: 从当前目录添加所有文件到固实压缩文件'-StrangeName' RAR a -s -- -StrangeName -ac 压缩或解压后清除存档属性(只有Windows版本可用). -ad 附加压缩文件名到目标路径。 这个选项可以在解压一组压缩文件时使用。默认条件下 RAR 把从压缩文 件解压的文件放在同一目录下,但是这个开关使从每个压缩文件解压 的文件都创建一个单独的目录。 例子: rar x -ad *.rar data\ RAR 将每一个解压的文件在'data'下创建子目录。 -ag[格式] 使用当前日期时间生成压缩文件名。 当创建压缩文件时附加当前日期字符串到压缩文件名上。用于每日备份。 附加的字符串格式有几种可选的格式参数定义或使用"YYYYMMDDHHMMSS"。 字符串的格式可以包含下列字符: Y - 年 M - 月 MMM - 使用文本字符串作为月名(Jan,Feb,等.) W - 年的第几周 (每星期从星期一开始) A - 星期几 (星期一 -1,星期日 - 7) D - 月的第几天 E - 年的第几天 H - 小时 M - 分 (如果在小时后,被作为分钟对待) S - 秒 N - 压缩文件数。RAR 搜索要生成的名字的文件是否存在,如果发现 它已经存在,将递增一个压缩文件数字,直到生成一个唯一的名字。 'N' 格式化字符在创建卷时不被支持。 上面列出的每个字符串仅表示添加到压缩文件名的一个字符。例如, 使用 WW 表示 2 数字的星期或 YYYY 定义 4 数字的年。 如果在格式化字符串的第一个字符是'+',日期字符串和基本压缩文件名 位置交换,所以日期将在压缩文件名之前。 格式化字符串可以包含在 '{' 和 '}' 包含的可选字符。此文本插入到压 缩文件名。 所有其它字符被不变地添加到文件名上。 如果你需要更新已经存在的压缩文件,小心使用 -ag 开关。依赖于以前 使用的 -ag 传送的格式化字符串和时间,生成的和现有的压缩文件名可 能不匹配。在这种情况下 RAR 会创建一个新的压缩文件,而不是更新现 有文件。 例子: 1) 使用默认 YYYYMMDDHHMMSS 格式 rar a -ag backup 2) 使用 DD-MMM-YY 格式 rar a -agDD-MMM-YY backup 3) 使用 YYYYMMDDHHMM 格式,替换'backup'之前的日期 rar a -ag+YYYYMMDDHHMM backup 4) 使用 YYYY-WW-A 格式,包含区段描述 rar a -agYYYY{year}-WW{week}-A{wday} backup 5) 使用 YYYYMMDD 和压缩文件数。它允许你在同一天使用 -agyymmdd-nn 数次,每一个新的压缩文件名都将包含一个新的递增数字。 rar a -agYYYYMMDD-NN backup -ao 添加带有存档属性的文件 (只有 Windows 版本可用). 例子: 添加C:上所有带有存档属性的文件到'f:backup',并清除文件存档属性 rar a -r -ac -ao f:backup c:\*.* -ai 忽略文件属性。 当解压时实用此开关,RAR 不对解压的文件设置存储在压缩文件的常 规文件属性。此开关保留由操作系统赋予新创建文件的属性。 在 Windows 它影响存档、系统、隐藏和只读属性。在 Unix ,用 户、组和其它文件属性。 -ap 压缩文件内部设置路径。当添加文件到压缩文件时,路径被整合到文 件名,解压时从文件名删除。 例如,如果你希望添加文件'readme.txt'到目录压缩文件'release' 的'DOCS\ENG',你可以运行: rar a -apDOCS\ENG release readme.txt 或者解压'ENG'到当前目录: rar x -apDOCS release DOCS\ENG\*.* -as 同步压缩文件内容 如果压缩时使用这个开关,这些在当前被添加文件列表不存在的被压缩 文件将从压缩文件删除。它对于使用这个开关和 -u(更新)组合同步一 个压缩文件和正在压缩目录的内容很便利。 例如,执行这个命令后: rar a -u -as backup sources\*.cpp 压缩文件'backup.rar'将只包含目录'sources'的*.cpp文件,所有其它 文件将被从压缩文件删除。它和创建新的压缩文件很相像,但是有一个 重要的不同:如果最近备份之后没有文件被修改,这个操作比创建新的压 缩文件执行得快。 -av 添加身份校验(只有注册版本可用)。RAR将在每次新建或更新压缩文件时 添加关于创建者的信息、最后更新时间和压缩文件名。 如果一个包含身份校验的压缩文件被修改,而没有指定这个开关,则身份 校验信息将被删除。 使用'-av'开关的压缩文件当解压、测试、列表或更新时,RAR 将进行完 整性确认并显示信息: 校验身份信息... 在成功校验身份的情况下,显示消息'确定',创建者的名字和最近更新 信息会被显示。在身份校验失败的情况下,将显示'失败'。 RAR 身份验证可以被伪造,不能提供基于公钥的现代数字签名方案同等的 安全级别。我们推荐实用此 RAR 功能仅作为信息,像一个特殊的压缩文 件注释。当关于压缩文件的创建者创建信息特别重要时,不要使用它。 为了启用身份校验功能,程序必须注册。请联系你当地的发布点或网站发 布心。 -av- 禁止检查或添加身份校验。 -cfg- 忽略配置文件和 RAR 环境变量。 -cl 转换文件名成小写字母。 -cu 转换文件名成大写字母。 -c- 禁止显示注释。 -df 压缩后删除文件 移动文件到压缩文件。这个开关与命令'A'组合执行和命令'M'是同一动 作。 -dh 打开共享文件 允许处理有其它应用程序打开写的文件。 如果应用程序允许对文件的读取访问,这个开关有效。但是如果文件的访 问类型是私有,文件打开操作仍然会失败。 这个选项很危险,因为它允许压缩一个文件,而同时正被其它应用程序修 改,所以小心使用。 -dr 删除文件到回收站 压缩后删除文件并把它们放到回收站。仅可用于 Windows 版本。 -ds 添加到一个固实压缩文件时不排序。 -dw 档案操作后清除文件 压缩后清除文件。在删除文件数据前使用 0 字节文件覆盖它们, 防止恢 复删除的文件。 -ed 不添加空目录 这个开关指出空目录不被存储到被创建的压缩文件。当解压这样一个压 缩文件时, RAR 会基于他们内部的文件路径创建非空的目录。关于空目录 的信息丢失。非空目录除了名字外(访问权限, 流, 等。)其他所有属性全 部丢失, 所以只有在你不需要保留这样的信息时使用此开关。 如果 -ed 和 'm' 命令或 -df 开关一起被使用,RAR 将不能移除空的目录。 -ee 不处理扩展属性 禁止保存和修复扩展文件属性。只用于OS/2版本。 -en 不添加"压缩文件结束"块 默认情况下,RAR 在新建或更新压缩文件时在结束时添加 "压缩文件结 束"块。它允许跳过像数字安全签名等扩展数据,但是在一些特定条件下 禁用这些功能可能有用。例如,如果在一个压缩文件通过不可靠的连接在 两个系统之间传递,并且同时发送者在它里面添加新文件时,它可能对确 认在传输过程已经接收的部分不会被另一端所修改很重要。 这个开关不能用在分卷上,因为压缩文件结束块包含正确处理卷的重要信 息。 -ep 从名称排除路径。包含此开关时,文件在加入压缩文件时不会包含路 径信息。这可能会有在压缩文件存在数个相同名称的结果。 -ep1 从文件名删除底层目录。不存储在命令行输入的路径。 例子: tmp 目录的所有文件和目录都将被添加到压缩文件'test',但是被压 缩文件名路径不包含'tmp\' rar a -ep1 -r test tmp\* 这等价于下列命令: cd tmp rar a -r ..\test cd .. -ep2 扩展路径成完全路径。压缩时存储文件的完全路径(除了盘符和根目录路 径). -ep3 扩展路径为包含盘符的完全路径。 仅用于 Win32 版本。 压缩时如果使用此开关则保存和恢复包括盘符的完全的文件路径。磁盘分 隔符(冒号)被下划线字符替换。 如果你解压时使用 -ep3,它把下划线改回为冒号并且把文件解压到它们 原始的目录和磁盘。如果用户也指定了目标路径,它会被忽略。 此开关对于把数个磁盘备份到同一个压缩文件有帮助。例如,你可以运行: rar a -ep3 -r backup.rar c:\ d:\ e:\ 来创建备份并且: rar x -ep3 backup.rar 来恢复它。 小心使用 -ep3 开关,只有你确认压缩文件不包含任何恶意文件。换句话 说,如果是你自己创建的压缩文件或你完全相信它的作者才使用它。此开 关允许覆盖在你的计算机上任何地方的任何文件,包括重要的系统文件和 通常仅用于备份和恢复的目的。 -e[+]<属性> 指定排除或包含掩码属性文件。 <属性> 是十进位,八进位(以 '0' 开头)或十六进位 (以 '0x' 开头) 的数字格式。 默认, 在 <属性>没有‘+’标记, 此开关定义排除掩码。如果对 <属性> 和文件属性按位进行 AND 逻辑运算的结果不为 0,则文件将不会被处理。 如果‘+’符号存在,它指定包含掩码。只有具有在掩码指定的属性 的至少一种的文件会被处理。 在 Windows 版本也可以使用D、S、H、A代替数字掩码符号表示目录和 文件的系统,隐藏,存档和只读属性。给出的属性的顺序并不重要。 Unix 版本支持 D 和 V 符号来定义目录和设备属性。 允许在命令行把 -e 和 -e+ 都指定。 示例: 1) 仅有文件夹名字而不包含它们的内容 rar a -r -e+d dirs 2) 不压缩系统和隐藏属性的文件: rar a -esh files -f 更新文件。可以在解压或创建压缩文件时使用。命令字符串"a -f"等价于 命令'f',你也可以和命令'm'或'mf'一起使用'-f' 。如果开关'-f'和命 令'x'或'e'一起使用,则只有旧文件能被从压缩文件解压的新版本替换。 3) 不解压只读文件: rar x -er files -hp[p] 加密文件数据和头。 这个开关和 -p[p] 类似,但是开关 -p 只加密文件数据,而使文件名等 其它信息可见。这个开关加密所有包括文件数据、文件名、大小、属性、 注释和其它块等所有可感知压缩文件区域,所以它提供了更高的安全等 级。在压缩文件使用-hp 加密,没有密码甚至不可能查看文件列表。 例子: rar a -hpfGzq5yKw secret report.txt 将添加文件 report.txt 到加密的压缩文件secret.rar,使用密码 'fGzq5yKw' -id[c,d,p,q] 禁用消息。 开关 -idc 禁用版权字符串。 开关 -idd 在操作结束禁止显示“完成”字符串。 开关 -idp 禁止百分比指示。 开关 -idq 打开安静模式, 仅错误消息和问题能被显示。 允许一次使用数个修饰, 如果开关 -idcdp 是正确的。 -ieml[.][地址] 使用 E-mail发送压缩文件。只有 Win32 版本可用。 附加一个使用添加命令创建或被更新的压缩文件到 E-mail 信息。你需 要有 MAPI 兼容的E-mail客户端来使用这个开关(大部分现代的 E-mail 程序支持MAPI接口)。 你可以在开关直接输入详细E-mail地址或留为空白。在以后可以由你的 E-mail 程序询问。可以指定用分号或逗号隔开的数个地址。 如果你添加一个'.'字母到 -ieml,成功附加到E-mail后压缩文件会被 删除。如果创建多卷压缩文件使用这个开关,每一卷都附加单独的 E-mail 信息。 -ierr 发送所有消息到标准错误设备。 -ilog[文件名] 记录错误到文件 (只有注册版本可用). 把错误信息写到 RAR 目录的 rar.log 文件。也可以在开关指定其 它的日志文件名代替默认的 rar.log,例如,-ilogc:\log\backup.log。 如果指定的文件名不包含路径,日志文件将会使用下列默认创建: 把错误信息写到 RAR 目录的 rar.log 文件。如果选项 "名称" 参数 没有指定, 日志文件将会使用下列默认创建: Unix: .rarlog 放在用户的 home 目录; Windows: rar.log 放在 %APPDATA%\WinRAR 目录; Dos: rar.log 放在 rar32.exe 文件相同的目录。 如果 "名称" 参数包含无路径的文件名, RAR 会在默认目录使用上面指 定的名称创建日志文件.如果你想改变日志文件的位置, 需要在 "名称"参 数包含路径和文件名。 例如: rar a -ilogc:\log\backup.log backup d:\docs 发生错误时会创建 c:\log\backup.log 日志文件。 -inul 禁止所有消息。 -ioff 在完成操作后关闭计算机。硬件必须支持断电功能。只有 Win32 版本可用。 -isnd 允许声音。 -k 锁定压缩文件. 任何试图改变压缩文件的命令都会被忽略。 -kb 保留损坏的解压文件。 RAR 默认解压后删除 CRC 错误的文件。开关 -kb 指定 CRC 错误的文件 不会被删除。 -m 设置压缩模式: -m0 存储 添加到压缩文件时不压缩文件。 -m1 最快 使用最快方式(低压缩) -m2 较快 使用快速压缩方式 -m3 标准 使用标准(默认)压缩方式 -m4 较好 使用较好压缩方式(较好压缩,但是慢) -m5 最好 使用最大压缩方式(最好的压缩,但是最慢) 如果没有指定这个开关,RAR使用-m3方式(标准压缩)。 默认情况下,RAR 在 -m1 和 -m2 模式只使用常规压缩算法,高级算法 像声音和真彩处理只有在 -m3..-m5 模式下才启用,提升的文本压缩只有 在 -m4..-m5 才被激活。默认值可以使用 -mc 开关替代。 -mc<参数> 设置高级压缩参数。 这个开关主要是用于进行测试和试验,在真实环境通常最好允许 RAR 自动选择最佳参数。请注意,不适当的使用这些开关可能导致非常严重执 行和压缩损失,所以只有在你清楚理解你所要做的时候使用它。 它有下列语法: -mc[参数1][:参数2][模块][+ 或 -] <模块>的位置是指示压缩算法的一个字符,它必须被设置。 它有下列值: A - 声音压缩; C - 真彩色(RGB)数据压缩; D - 增值压缩; E - 32-位 x86 Intel 可执行文件压缩; I - 64-位 Intel Itanium 可执行文件压缩; T - 文本压缩。 在开关结尾的'+'标记应用选择的算法模块处理所有的数据,'-'完全禁用 该模块。如果没有指定标记,RAR 将基于数据和当前的压缩模式自动选择 模块。 开关 -mc- 禁止所有可选模块,只允许常规的压缩算法。 <参数1> 和 <参数2> 根据模块而决定的参数,其描述如下。 音频压缩,增值压缩: <参数1> 是通道的字节数 (可以是1 - 31)。RAR 拆分多位声道成单位声 道,例如,两个16位音频声道可以被 RAR 看作每个宽一字节的四个声道。 <参数2> 被忽略。 32位 x86 Intel 可执行文件压缩, 64位 Intel Itanium 可执行文件压缩, 真彩(RGB)数据压缩: <参数1> 和 <参数2> 被忽略。 文本压缩: <参数1> 是 PPM 算法的次序+(可以是 2 - 63)。通常高的值会略微提高 多余数据的压缩率,但是必须有足够的内存来用于 PPM。在缺乏内存的条 件下结果可能相反。更高的规则值会减慢压缩和解压的速度。 <参数2>对于 PPM 可用的以兆字节位单位的内存 (1-128)。更高的值可以 提高压缩率,但是注意PPM压缩和解压使用的内存大小相等,所以创建一 个压缩文件时如果分配太多的内存,其他人在安装了比较少内存的机器上 解压它时可能出现问题。解压缩也可以使用虚拟内存,但是可能变得非常 慢。 例子: 1) 开关 -mc1a+ 强制使用对所有数据使用8位单声道声音压缩算法。 2) 开关 -mc10:40t+ 强制使用对所有数据使用文本压缩优化算法,设置压 缩次序到 10 并分配40 MB内存。 3) 开关 -mc12t 设置压缩次序到 12,设置文本压缩顺序为12,当使用文 本压缩时,让RAR决定何时使用它。 4) 开关 -mct- -mcd- 禁止文本和增值压缩。 -mdKB大小选择字典大小。必须是64,128,256,512,1024,2048或4096或 单个字母 'a','b','c','d','e','f','g'。 这个可变大小的字典是被压缩算法使用的专用的内存区域。如果被压缩文 件的大小(或在一个固实压缩文件的总文件大小)比压缩文件大许多,则 通常增加字典大小会增加压缩率,减慢压缩速度和增加内存需要。 如果字典比原数据大,RAR可以减少字典大小.它可以减少内存的需要而不 会减小压缩比。 默认可变字典大小是 4096 KB. 例子: RAR a -s -mdd sources *.asm 或者 RAR a -s -md512 sources *.asm 将使用512 KB字典创建固实压缩文件。 -ms[列表] 指定存储文件类型。 指定不压缩而直接存贮的文件类型。这个开关被用来存储已经压缩的文件, 这将帮助增加压缩速度,而不会显著的减小压缩率。 可选参数 <列表> 参数定义使用分号隔开的文件扩展名列表。例如, -msrar;zip;jpg 将强制RAR不压缩直接存储所有的RAR和ZIP压缩文件和 JPG 图像。它也允许在列表指定通配符文件掩码,所以 -ms*.rar; *.zip;*.jpg 也可以工作。 如果 <列表> 没有被指定,-ms 开关将使用默认的包含下列文件类型的扩 展设置: 7z, ace, arj, bz2, cab, gz, jpeg, jpg, lha, lzh, mp3, rar, taz, tgz, z, zip -mt<线程> 设置线程数。仅可用于 Window 版本。 <线程> 参数可以是从 0 到 16 的值。它定义对于压缩算法活动线程的 推荐数。如果它大于 0,RAR 会使用多线程版本的压缩算法,在多处理 器系统上提供更高的速度。真实的活动线程数可能和指定的不同。 如果 <线程> 是 0,RAR 会使用单线程压缩算法。 改变 <线程> 参数轻微影响压缩率,所以如果所有其它压缩参数相等而 使用不同的 -mt 开关创建的压缩文件不会解压得一样连贯。 如果没有指定 -mt 开关,RAR 会尝试检测可用的处理器的数量并自动 选择优化的线程数。 -n<文件> 仅包含指定的文件 <文件>。通配符在文件掩码的名称和文件部分都可用。 你可以数次指定开关‘-n’。 此关不能替换通常的文件掩码,仍然需要在命令行输入。它是一个附加 的过滤器限制处理的文件那些仅匹配在 –n 开关指定掩码的文件。某些 时候它可以帮助减少命令行的长度。 例如,如果你需要压缩在 Project 和 Info 文件夹内的所有的 *.txt 和 *.lst 文件,你可以输入: rar a -r text Project\*.txt Project\*.lst Info\*.txt Info\*.lst 或使用开关 -n: rar a -r -n*.txt -n*.lst text Project Info -n@<列表文件> 包含在指定的列表文件列出的文件。 和 -n<文件> 开关类似,但是从列表文件读取掩码。 示例: rar a -r -n@inclist.txt text Project Info -oc 设置 NTFS 压缩属性。只可用于 Win32 版本。 此开关允许解压文件时恢复 NTFS 压缩属性。RAR 在创建一个压缩文件时 保存“压缩”文件属性,但是如果不指定 -oc 开关就不会恢复它们。 -ol 把符号链接作为链接而不是文件。 只有 Unix 版本可用。 -or 如果相同名字的文件已经存在则自动重命名解压的文件。重命名文件将得 到象 'filename(N).txt' 的名字,'filename.txt' 的位置是原始的文件 名,如果文件存在 'N' 是从 1 增加数字。 -os 保存 NTFS 流。 只有 Win32 版本可用。 这个开关意味着只能在 NTFS 文件系统下使用,并允许储存与文件相关的 交替数据流。在 Windows 2000、XP 和更新的 Windows 版本底下尤其重要, 可以用来保存某些文件依赖信息,如文件描述。如果您使用 RAR 来备份您 的 NTFS 磁盘时,建议您指定这个开关。 -ow 当压缩时保存文件安全信息和解压时恢复它们时,使用这个开关。 Unix 版本的 RAR 当使用这个开关时保存文件所有者和组。 Win32 版本存储所有者、组、文件许可和校验信息,但是你必须有读取 它们的必需的权限。 注意只有 NTFS 文件系统支持在Windows下的文件基 本安全数据。 -o[+|-] 设置覆盖模式。可以在解压或更新文件时使用。下列模式可用: -o 覆盖前询问 (默认用于解压文件); -o+ 覆盖所有 (默认用于更新的压缩文件); -o- 跳过已存在的文件。 -o+ 覆盖已存在的文件。 -o- 不覆盖已存在的文件。 -p[p] 压缩时,使用字符串

作为密码加密文件。密码大小写敏感。如果你在 命令行忽略密码,你会看到一个输入密码的提示。 例子: rar a -pmyhoney secret1 *.txt 添加 *.txt文件并用密码"myhoney"加密. -p- 不询问密码 -r 包含子文件夹,可以使用命令: a,u,f,m,x,e,t,p,v,l,c,cf 和 s. 当使用命令 'a','u','f','m' 将处理在所有子目录以及当前工作目 录的的文件。 当使用命令 x,e,t,p,v,l,c,cf 或 s 将处理在子目录以及当前工 作目录所有压缩文件。 -r- 禁用递归。 在某些情况下,即使没有指定 -r 开关 RAR 也会自动启用递归。开关 -r- 禁止它。 压缩时如果你指定了目录名,目录名不包含通配符,即使 -r 开关没有指定, 默认 RAR 添加目录的内容。如果磁盘根目录没有把通配符作为文件掩码指定, RAR 也会自动启用递归。开关 -r- 禁用此行为。 例子: rar a -r- arc dirname 命令仅会添加空目录 'dirname' 目录并忽略它的内容。下列命令: rar a -r- arc c:\ 会仅压缩 c: 根目录的内容并不会包含子目录。 -r0 和 -r 相似,但是当使用命令 'a','u','f','m' ,将返回包含包括通 配符 '*' 和 '?'的子目录 -ri

[:] 设置优先级和休眠时间。只有在 Windows 版本的 RAR 可用。 这个开关让 RAR 在多任务环境下时,用来控制系统载入负荷。可用任务 优先级值从 0 到 15。当

等于 0 时,使用默认任务优先级。1 对应 最低的任务优先权,15 - 最高。 休眠时间 是从 0 到 1000 (千分之一秒)的值。这是 RAR 压缩或解 压缩操作期间每次读或写时将会归还到系统的时段。休眠时间设定在几个 相同优先级任务在系统同时运行时有用。 例子: 使用默认优先级执行 RAR,并且每次读取或写入后有10 ms的休眠 rar a -r -sfx -ri0:10 backup *.* -rr[N] 添加数据恢复记录。这个开关在创建或修改压缩文件被用来添加压缩文件 数据的恢复记录。 -rv[N] 创建恢复卷。这个开关在创建多卷压缩文件时用来创建恢复卷。查看 'rv[N]'命令的详细描述。 -s 创建固实压缩文件。固实格式是一种特别的压缩文件类型。请参考附录的 “术语表”获得更多信息。 例子: 使用512KB的字典创建固实压缩文件 sources.rar ,包含全部子目录,从 当前目录开始,只添加.asm文件: rar a -s -md512 sources.rar *.asm -r -s 根据文件计数创建固实组 和 -s 相似,但是在压缩文件后重置压缩文件的状态。通常减少压缩率, 但是也能减少损坏的固实压缩文件的文件丢失。 -sc<字符集>[对象] 指定列表文件和压缩包注释文件的字符集。 “字符集”参数是强制的, 可以使用下列值: U - Unicode; A - ANSI (Windows) 编码。仅用于 Windows 版本; O - OEM (DOS) 编码。仅用于 Windows 版本; Unicode 格式的文件必须以 FFFE 或 FEFF Unicode 字符开头, 否则 RAR 会 忽略此开关并作为 ASCII 文本处理。 “对象”参数是可选的, 可以使用下列值: L - 列表文件; C - 命令文件。 它允许指定不只一个对象, 例如, -scolc。如果 '对象' 参数丢失, '字符 集' 会应用到所有对象。 此开关允许指定在 -z[文件] 开关的文件的字符集, 列表文件和注释文 件在 "cw" 命令写入。l 例子: 1) rar a -scol data @list 使用 OEM 编码读取 'list' 包含的名称。 2) rar c -scuc -zcomment.txt data 读取 comment.txt 为 Unicode 文件。 3) rar cw -scuc data comment.txt 写入 comment.txt 为 Unicode 文件。 -se 根据扩展名创建固实组 和 -s 相似,但是如果文件扩展名改变,重置压缩文件的状态。通常减少压 缩率,但是也能减少损坏的固实压缩文件的文件丢失。 -sfx[名称] 创建自解压压缩文件。如果建立新压缩文件时使用此开关,自解压文件(使 用 default.sfx 模块或在开关指定)将被创建。在 Windows 版本, default.sfx 应该在 rar.exe 所在的目录,在 Unix - 在用户的 home 目录。在/usr/lib 或 /usr/local/lib 。 例子: rar a -sfxwincon.sfx myinst 使用 wincon.sfx 自解压模块创建自解压(SFX)压缩文件。 -si[名称] 当创建一个压缩文件时,从 stdin(标准输入)读取数据。选项“名称”参 数允许指定要创建的压缩文件内的标准输入数据的文件名。如果这个参数 丢失,名字会被设为“stdin”。此开关不能和 -v 一起使用。 例子: type Tree.Far | rar a -siTree.Far tree.rar 将把 'type Tree.Far' 作为 'Tree.Far' 文件压缩输出. -sv 创建互不依赖的固实压缩文件 当开始一个新的卷时,RAR 默认尽可能的尝试重置固实格式状态,但是只有 在上一次复位后,又压缩了足够多的数据。(至少几兆字节)。 这个开关会强制 RAR 忽略打包的数据大小,并试图对任何大小的分卷重置 状态。这会降低压缩率,但在固实卷组的数个卷之一丢失或损坏时可以 增加解压部分数据的机会。 注意有时候 RAR 即使使用这个开关也无法重置状态。例如,当压缩一个 大文件成许多分割卷时就不能完成。RAR 只能在分离文件之间重置状态, 而不能用在单独文件上。 在创建不带卷的压缩文件时忽略。 -sl<大小> 仅处理大小小于在此开关的 <大小> 参数指定的大小的文件。 参数 <大小> 必须以字节为单位指定。 -sm<大小> 仅处理大小超过在此开关的 <大小> 参数指定的大小的文件。 参数 <大小> 必须以字节为单位指定。 -sv- 创建互相依赖的固实压缩文件 禁止卷之间重设固实状态。 这将稍微提高压缩率,但是意味着如果数个固实卷之一丢失或损坏时减 少解压部分数据的机会。 在创建不带卷的压缩文件时忽略。 -s- 禁止固实压缩 -t 压缩后测试文件。这个开关在和移动命令组合使用时非常有用,所以只有 压缩文件已经被成功测试后,文件才会被删除。 -ta<日期> 只处理指定日期之后修改的文件。 日期字符串的格式是 YYYYMMDDHHMMSS。它允许在日期字符串插入'-' 或 ':'的分隔符,并忽略后部区域。例如,下列开关是正确的: -ta2001-11-20在内部它被转换成 -ta20011120000000 并作为"从2001 年11月20日0时0分0秒后修改的区域"对待。 -tb<日期> 只处理指定日期之前修改的文件。开关的格式和 -ta<日期> 相同。 -tk 保存原始压缩文件日期。防止当正在改变一个压缩文件时RAR修改文件。 -tl 设置压缩文件的日期为最新文件的日期。强制RAR设置改变的压缩文件的日 期为压缩文件最新文件的日期。 -tn<时间> 处理指定时间以后的新文件。时间字符串格式时: [d][h][m][s] 例如,使用开关 -tn15d 来处理更新了15天的文件,-tn2h30m 来处理更 新了2小时30分的文件。 -to<时间> 处理指定时间以前的旧文件。开关的格式和 -tn<时间> 相同。 -ts[N] 保存或恢复文件时间(修改,创建,访问)。 开关 -tsm 指示 RAR 保存文件的修改时间,-tsc - 创建时间,tsa - 最 近访问时间。开关后的可选参数是 0 和 4 之间的数字来控制文件时间精 度。值‘1’启用 1 秒的精确度,2 - 0.0065536 秒, 3 - 0.0000256,4 或‘+’启用最大的 NTFS 时间精度,等于 0.0000001 秒。值‘0’或‘-’ 意味着创建和访问时间不保存,并且修改时间使用低的(两秒)时间精度。 更高的精度模式添加更多的数据到压缩文件,使用 -tsm4 -tsa4 -tsc4 组合,让每个文件增加 19 个额外的字节。如果没有指定精度,RAR 使用 ‘4’(高)值。 默认的 RAR 模式是 -tsm4 -tsc0 -tsa0,所以高精度的修改时间被存储, 其它时间被忽略。 当解压文件(精度不相关,但是不能为 0)时指定 -tsc 和 -tsa 开关来设置 创建和访问时间是必需的。默认 RAR 只设置修改时间,即使压缩文件包含 创建和最近修改时间。设置修改时间来解压文件也可以使用 -tsm- 禁用。 如果你需要把这个开关应用到所有的三个时间,也可能忽略这三个类型字母。 例如,-tsm4 -tsa4 -tsc4 能被 -ts4, -ts+ 或 -ts 代替。使用 -ts- 来 只保存低精度的修改时间,或者忽略所有三个文件时间解压。 当创建一个压缩文件时,如果高的模式不被文件系统支持,RAR 会自动减少 精度。在 FAT 不会超过两秒,在 Unix 不会超过 1 秒。NTFS 时间精 度是 0.0000001 秒。 操作系统时间限制解压时能被设置。Windows 允许设置三个时间,Unix - 修改时间和最近访问时间,没有创建时间,DOS 只支持修改时间。 例子: 1) rar a -ts backup 使用最高精确度存储所有文件时间。 2) rar x -tsa backup 存储修改和最近访问时间。开关 -tsm 不是必需的,因为 RAR 把它作为默 认值。 3) rar a -tsm1 -tsc1 backup 存储低精确度的修改和创建时间。没有 -tsm1 RAR 将会保存高精确的修改 时间。 -u 更新文件。 这可在解压或创建压缩文件时使用。命令字符串 'a -u' 和 命令 'u'等效。您也可以使用开关'-u'和命令'm'和'mf'一起使用。如果开 关'-u'使用与命令'x'或'e'一起使用,则在磁盘上不存在的文件和比在磁 盘上的拷贝新的文件将从压缩文件解压。 -v 创建自动检测大小的卷或列出所有的卷 当正在创建或正在列表卷时这个开关可以使用。 在第一种情况下,它启用卷的自动大小检测,所以新的卷将使用目标媒体 上的所有可用空间。当在可移动磁盘上创建卷时非常便利。你可以在 -v <大小> 的描述读到更多关于卷的信息。 在第二种情况下,在命令行当这个开关和'V' 或 'L'命令一起使用,它 强制 RAR 列出从指定卷开始的所有卷的内容。没有这个开关,RAR 只显 示单独的被指定卷的内容。 -v<大小>[k|b|f|m|M|g|G] 建立卷,大小=<大小>*1000 [*1024 | *1]。 默认此开关使用 <大小> 作为一千(1000)字节(非1024 字节)。您也可以 输入符号 "k" 来表示千字节(1024)的大小,或者符号 "b" 表示字节,兆 字节(1024 x 1024)为 -"m",而一百万个字节是 - "M",G字节 - 'g', 十亿个字节 - 'G' 或者使用符号 "f" 从几个预先定义的数值选择一个。 预先定义的数值有 360、720、1200、1440 或 2880 并会使用当前软盘大 小取代。 如果大小被忽略,将使用自动检测。 你可以指定几个 -v 开关来为不同的卷设置不同的大小。例如: rar a -v100k -v200k -v300k arcname 第一卷设为 100 KB 大小, 第二卷设为 200 KB, 剩下的为 300 KB。 如果在可移动磁盘上创建卷,第一卷被创建后,用户将被提示: 创建下一卷: 是/否/全部 此时,您可以改变磁盘。回答'A'将使所有的卷不暂停地被创建。 默认 RAR 卷以'volname.partNNN.rar'格式命名,NNN的地方是卷号。使 用-vn开关可能转换成其它的扩展基本命名规则,卷组第一卷文件由.rar 的扩展名,以后卷从 .r00 到 .r99 命名。 当解压或测试多卷压缩文件时,你必须只使用第一卷的文件名。如果在驱 动器没有下一卷并且磁盘可移动,用户会被提示: 插入磁盘带有 <下一卷名> 插入带有正确卷的磁盘并按任意键。 如果在解压过程,下一卷没有找到或卷放在不可移动磁盘上,RAR 将显 示下列信息后断: 没有找到 <卷名> 压缩卷不可以被修改。命令'd','f','u','s' 不能在多卷组使用。 命令'a'只可以用在创建新的多卷序列时。 也许,虽然不太可能,多卷组文件大小可能比未压缩时大,原因是'存 储'特征(如果大小增加时不压缩)在多卷组不能启用。 压缩卷可以是自解压格式,这样的压缩文件可使用 '-v' 或 '-sfx'开关 创建。 例子: 创建固定大小的固实分卷压缩文件: rar a -s -v1440 floparch.rar *.* 将创建固实的1440000字节大小的卷。 -vd 创建卷之前清除磁盘内容 当使用 '-vd' 时,目标盘上的所有文件和目录都将被删除。这个开关只 能用在可移动磁盘上,使用这个开关不能删除硬盘内容。 -ver[n] 文件版本控制 当在已经存在的压缩文件更新文件时,强制 RAR 保留前一文件版本。 旧版本被命名为'filename;n','n'处是版本号。 当不使用开关 -ver 解压一个压缩文件,rar 默认只解压最近添加的文件 版本,它的名字不能包含数字后缀。但是如果你正确指定了文件名,包括 版本,它也可以解压。例如,'rar x arcname'将只解压最新版本,当使 用 'rar x arcname file.txt;5' 将解压 'file.txt;5',如果它在压缩 文件存在的话。 解压时如果你不带参数指定-ver开关, RAR 将解压所有和文件掩码匹配的所有文件的所有版本。这样版本号没 有从未压缩文件名删除。你也可以使用数字作为-ver的参数来解压一个 具体的文件版本。它将告诉RAR只解压这个版本并从文件名删除版本号。 例如,'rar x -ver5 arcname' 将只解压第五版本文件。 如果压缩时你指定了‘n’参数,它会限制在压缩文件文件版本的最大 数字。超过此限制的旧的文件版本会被移除。 -vn 使用旧风格的卷命名法则 默认 RAR 卷以'volname.partNNN.rar'格式命名,NNN的地方是卷号。使 用-vn开关可能转换成其它的扩展基本命名规则,卷组第一卷文件由 .rar 的扩展名,以后卷从 .r00 到 .r99 命名。它可能有用,如果你要 在 MS DOS下解压一个压缩文件时,不允许在文件名超过一个点'.'。 -vp 每一卷后暂停 默认 RAR 仅在使用可移动驱动器创建或解压下一卷前,进行更换磁盘的 询问。这个开关将强制 RAR 总是进行这样的询问。如果磁盘空间有限而 且你希望创建后立即复制每一卷到其它磁盘时,可以使用它。 -w

作为工作目录。这个开关可以用来分配临时文件工作目录。 -x 排除指定的文件 ,通配符可以用在名称和文件掩码的文件部分。你 可以数次指定开关'-x'。 如果掩码包含通配符,它应用到当前目录和它的子目录。没有通配符它不 递归,所以如果你要在所有文件夹排除某些“文件名”,你需要指定两 个掩码:用于当前目录的“文件名”和用于子目录的“*\filename”。如果 你知道一个文件的确切路径,你可以是使用“路径\文件名”语法来仅排除 “文件名”的此副本。如果你在解压一个压缩文件时使用 -x路径\文件名 语法,“路径”必须是一个压缩文件内的路径,而不是在解压后的磁盘上 的文件路径。 例子: 1) rar a -r -x*.bak -x*.rar rawfiles *.bak 和 *.rar 不会添加到 rawfiles 2) rar a -r -x*\temp -x*\temp\* savec c:\* 压缩 C: 上除了 Temp 文件夹的临时目录和文件外的所有文件 3) rar x -x*.txt docs 从 docs.rar 解压除了 *.txt 外的所有文件 -x@ 排除指定文件列表列出的文件。如果你使用 -x@ 而没有列表文件名参数, 它会从标准输入设备读取文件名。 例子: rar a -x@exlist.txt arch *.exe -y 对于所有询问全部回答是。 -z[f] 从文件读取压缩文件注释。如果你需要指定注释文本文件的字符 集使用 -sc 开关。如果 没有指定, 注释从标准输入设备读取。 限制 ~~~~ 路径名长度小于 259 个字符。 最大的压缩文件注释的长度是 62000 字节。 命令限制: 命令 'd','u','f','c','cf' 不能用于分卷压缩文件。 命令 'a' 不能用来更新分卷压缩文件,只能用来创建一个新的。 返回值 ~~~~~~ RAR 成功操作后返回 0 。非 0 返回码意味着操作由于某种错误被取消: 255 用户断 用户断操作 9 创建错误 创建文件错误 8 内存错误 没有足够的内存进行操作 7 用户错误 命令行选项错误 6 打开错误 打开文件错误 5 写错误 写入磁盘错误 4 被锁定压缩文件 试图修改先前使用 'k' 命令锁定的压缩文件 3 CRC 错误 解压缩时发生一个 CRC 错误 2 致命错误 发生一个致命错误 1 警告 没有发生致命错误 0 成功 操作成功 术语表 ~~~~~~ 压缩文件 包含一个或一个以上文件的压缩和/或加密的特定文件。 压缩 减少数据大小的编码方法。 CRC 循环冗余检查。为了验证数据正确性检查特定信息的数学计算方法。 SFX 压缩文件模块执行时用于解压文件(自解压文件模块),通常是一个 .EXE格式文件。 固实 对压缩文件使用专用的压缩方式(把所有文件看成一个连续的数据 流)打包。当压缩大量小文件特别有利。 卷 压缩文件的拆分部分。把一个压缩文件拆分成存储在磁盘上。固实 格式卷解压时必须从序列的第一个开始。 版权所有 (c) 1993-2009 Alexander Roshal

RAR 是一个让你在命令行模式管理压缩文件的控制台应用。RAR 提供压缩、加 密、数据恢复和许多其它此手册描述的其它功能。 RAR 只支持 RAR 格式压缩文件,它默认有 .rar 扩展名。不支持ZIP 和其他格 式。即使创建压缩文件时指定了 .zip 扩展名,它仍然是 RAR 格式的。Windows 用户 可以 WinRAR,它支持更多的压缩文件类型,包括 RAR 和 ZIP 格式。 WinRAR 提供了图形用户界面和命令行模式。虽然控制台 RAR 和图形界面 WinRAR 有相似的命令行语法,但是它们还有有一些不同。所以推荐使用此 rar.txt 手册用于 控制台 RAR(rar.exe 在 Windows 版本的情况下),winrar.chm 是图形界面 WinRAR (winrar.exe) 的帮助文件。 配置文件 ~~~~~~~~ Unix 版本的 RAR 从用户的 home 或 /etc 目录的 .rarrc 文件读取配置文件信息 (存储在 HOME 环境变量) Windows 的版本 RAR 从 rar.ini 文件读取配置文件信息,它放在 rar.exe 文件相 同的目录。 这个文件包含下列字符串: switches=任何 RAR 开关,用空格分开 例如: switches=-m5 -s 环境变量 ~~~~~~~~ 可以通过建立"RAR"环境变量来添加默认参数到命令行. 例如,在 Unix ,下列命令行可以被添加到你的配置: RAR='-s -md1024' export RAR RAR 将使用这个字符串作为命令行的默认参数,并将使用 1024KB 字典大小来创建 “固实”压缩文件。 RAR 控制选项使用下列优先级: 命名行开关 最高优先级 在 RAR 变量的开关 低优先级 保存在配置文件的开关 最低优先级 日志文件 ~~~~~~~~ 如果在命令行或配置文件指定开关 -ilog ,RAR 将会把处理压缩文件遇到的错误 等写到日志文件读取开关 -ilog 描述获得更多信息。 固实压缩的文件列表 - rarfiles.lst ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ rarfiles.lst 包含一个用户定义的文件列表,告诉 RAR 添加文件到固实压缩文件时的顺 序。它可以包含文件名通配符和指定项目 -$default。默认项目定义了这个文件与 其他项目不相符时的顺序清单位置。 注释字符是 ';'. 在 Windows ,这个文件应该放在 RAR 所在的或 %APPDATA%\WinRAR 目录, 在 Unix - 放在用户的 home 目录或在 /etc 。 提高压缩率和操作速度的提示: - 在压缩文件,小文件应该被组织在一起; - 频繁被处理的文件应该放在开始的位置。 普通的掩码越靠近顶端优先权就越高,但是这个规则存在例外。如果 rarfiles.lst 包含两个掩码,并且所有文件既匹配第一个掩码,也匹配第二个掩码, 较小的子集 或者更精确的匹配拥有更高的优先权。例如,如果你用 *.cpp 和 f*.cpp 掩码, f*.cpp 拥有更高的优先权。 RAR 命令行语法 ~~~~~~~~~~~~~~ 语法 RAR [ - ] [ ] [ ] [ ] 描述 命令行选项 (命令和开关) 提供了使用 RAR 创建和管理压缩文件的控制方法。命 令是一个字符串(或单个的字母),命令 RAR 去执行一个相应的操作。开关被用来 改变 RAR 执行操作的方法。其它参数是压缩文件名和被压缩的文件或要从压缩文件 被解压文件。 列表文件是一个包括处理的文件名的纯文本文件。第一列应该以文件名开始。可以 在//字符后添加注释。例如,你可以创建包含下列字符串的 backup.lst: c:\work\doc\*.txt //备份文本文档 c:\work\image\*.bmp //备份图片 c:\
集合了 所有的 Unix命令大全 登陆服务器时输入 公帐号 openlab-open123 telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss 老师测评网址 http://172.16.0.198:8080/poll/ 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ 一、注意事项 命令和参数之间必需用空格隔开,参数和参数之间也必需用空格隔开。 一行不能超过256个字符;大小写有区分。 二、特殊字符含义 文件名以“.”开头的都是隐藏文件/目录,只需在文件/目录名前加“.”就可隐藏它。 ~/ 表示主目录。 ./ 当前目录(一个点)。 ../ 上一级目录(两个点)。 ; 多个命令一起用。 > >> 输出重定向 。将一个命令的输出内容写入到一个文件里面。如果该文件存在, 就将该文件的内容覆盖; 如果不存在就先创建该文件, 然后再写入内容。 输出重定向,意思就是说,将原来屏幕输出变为文件输出,即将内容输到文件。 < << 输入重定向。 本来命令是通过键盘得到输入的,但是用小于号,就能够使命令从文件得到输入。 \ 表示未写完,回车换行再继续。 * 匹配零个或者多个字符。 ? 匹配一个字符。 [] 匹配括号里的内容[a-z][A-Z][0-9]。 ! 事件。 $ 取环境变量的值。 | 管道。把前一命令的输出作为后一命令的输入,把几个命令连接起来。 |经常跟tee连用,tee 把内容保存到文档并显示出来。 三、通用后接命令符 -a 所有(all)。 -e 所有(every),比a更详细。 -f 取消保护。 -i 添加提示。 -p 强制执行。 -r 目录管理。 分屏显示途操作 空格 继续打开下一屏; 回车 继续打开下一行; b 另外开上一屏; f 另外开下一屏; h 帮助; q或Ctrl+C 退出; /字符串 从上往下查找匹配的字符串; ?字符串 从下往上查找匹配的字符串; n 继续查找。 四、退出命令 exit 退出; DOS内部命令 用于退出当前的命令处理器(COMMAND.COM) 恢复前一个命令处理器。 Ctrl+d 跟exit一样效果,表止本次操作。 logout 当csh时可用来退出,其他shell不可用。 clear 清屏,清除(之前的内容并未删除,只是没看到,拉回上面可以看回)。 五、目录管理命令 pwd 显示当前所在目录,打印当前目录的绝对路径。 cd 进入某目录,DOS内部命令 显示或改变当前目录。 cd回车/cd ~ 都是回到自己的主目录。 cd . 当前目录(空格再加一个点)。 cd .. 回到上一级目录(空格再加两个点)。 cd ../.. 向上两级。 cd /user/s0807 从绝对路径去到某目录。 cd ~/s0807 直接进入主目录下的某目录(“cd ~"相当于主目录的路径的简写)。 ls 显示当前目录的所有目录和文件。 用法 ls [-aAbcCdeEfFghHilLmnopqrRstux1@] [file...] ls /etc/ 显示某目录下的所有文件和目录,如etc目录下的。 ls -l (list)列表显示文件(默认按文件名排序), 显示文件的权限、硬链接数(即包含文件数,普通文件是1,目录1+)、用户、组名、大小、修改日期、文件名。 ls -t (time)按修改时间排序,显示目录和文件。 ls -lt 是“-l”和“-t”的组合,按时间顺序显示列表。 ls -F 显示文件类型,目录“/ ”结尾;可执行文件“*”结尾;文本文件(none),没有结尾。 ls -R 递归显示目录结构。即该目录下的文件和各个副目录下的文件都一一显示。 ls -a 显示所有文件,包括隐藏文件。 文件权限 r 读权限。对普通文件来说,是读取该文件的权限;对目录来说,是获得该目录下的文件信息。 w 写权限。对文件,是修改;对目录,是增删文件与子目录。 (注 删除没有写权限的文件可以用 rm -f ,这是为了操作方便,是人性化的设计)。 x 执行权限;对目录,是进入该目录 - 表示没有权限 形式 - rw- r-- r-- 其 第一个是文件类型(-表普通文件,d表目录,l表软链接文件) 第2~4个是属主,生成文件时登录的人,权限最高,用u表示 第5~7个是属组,系统管理员分配的同组的一个或几个人,用g表示 第8~10个是其他人,除属组外的人,用o表示 所有人,包括属主、属组及其他人,用a表示 chmod 更改权限; 用法 chmod [-fR] <绝对模式> 文件 ... chmod [-fR] <符号模式列表> 文件 ... 其 <符号模式列表> 是一个用逗号分隔的表 [ugoa]{+|-|=}[rwxXlstugo] chmod u+rw 给用户加权限。同理,u-rw也可以减权限。 chmod u=rw 给用户赋权限。与加权限不一样,赋权限有覆盖的效果。 主要形式有如下几种 chmod u+rw chmod u=rw chmod u+r, u+w chmod u+rw,g+w, o+r chmod 777( 用数字的方式设置权限是最常用的) 数字表示权限时,各数位分别表示属主、属组及其他人; 其,1是执行权(Execute),2是写权限(Write),4是读权限(Read), 具体权限相当于三种权限的数相加,如7=1+2+4,即拥有读写和执行权。 另外,临时文件/目录的权限为rwt,可写却不可删,关机后自动删除;建临时目录:chmod 777 目录名,再chmod +t 目录名。 id 显示用户有效的uid(用户字)和gid(组名) 用法 id [-ap] [user] id 显示自己的。 id root 显示root的。 id -a root 显示用户所在组的所有组名(如root用户,是所有组的组员) df 查看文件系统,查看数据区 用法 df [-F FSType] [-abeghklntVvZ] [-o FSType 特定选项] [目录 | 块设备 | 资源] df -k 以kbytes显示文件大小的查看文件系统方式 六、显示文件内容 more 分屏显示文件的内容。 用法 more [-cdflrsuw] [-行] [+行号] [+/模式] [文件名 ...]。 显示7个信息:用户名 密码 用户id(uid) 组id(gid) 描述信息(一般为空) 用户主目录 login shell(登录shell) cat 显示文件内容,不分屏(一般用在小文件,大文件显示不下);合并文件,仅在屏幕上合并,并不改变原文件。 用法 cat [ -usvtebn ] [-|文件] ... tail 实时监控文件,一般用在日志文件,可以只看其的几行。 用法 tail [+/-[n][lbc][f]] [文件] tail [+/-[n][l][r|f]] [文件] 七、文件/目录的增删 echo 显示一行内容。 touch 如果文件/目录不存在,则创建新文件/目录;如果文件存在,那么就是更新该文件的最后访问时间, 用法 touch [-acm] [-r ref_file] 文件... touch [-acm] [MMDDhhmm[yy]] 文件... touch [-acm] [-t [[CC]YY]MMDDhhmm[.SS]] file... mkdir 创建目录(必须有创建目录的权限) 用法 mkdir [-m 模式] [-p] dirname ... mkdir dir1/dir2 在dir1下建dir2 mkdir dir13 dir4 dir5 连建多个 mkdir ~/games 用户主目录下建(默认在当前目录下创建) mkdir -p dir6/dir7/dir8 强制创建dir8;若没有前面的目录,会自动创建dir6和dir7。 不用-p时,若没有dir6/dir7,则创建失败。 cp 复制文件/目录 cp 源文件 目标文件 复制文件;若已有文件则覆盖 cp -r 源目录 目标目录 复制目录;若已有目录则把源目录复制到目标目录下, 没有目标目录时,相当于完全复制源目录,只是文件名不同。 cp beans apple dir2 把beans、apple文件复制到dir2目录下 cp -i beans apple 增加是否覆盖的提示 mv 移动或重命名文件/目录 用法 mv [-f] [-i] f1 f2 mv [-f] [-i] f1 ... fn d1 mv [-f] [-i] d1 d2 mv 源文件名 目标文件名 若目标文件名还没有,则是源文件重命名为目标文件;若目标文件已存在,则源文件覆盖目标文件。 mv 源文件名 目标目录 移动文件 mv 源目录 目标目录 若目标目录不存在,则源目录重命名;若目标目录已存在,则源目录移动到目标目录下。 rm 删除文件/目录 用法 rm [-fiRr] 文件 ... rm 文件名 删除文件。 rm -r 目录名 删除目录。 rm –f 文件 只要是该文件或者目录的拥有者,无论是否有权限删除,都可以用这个命令参数强行删除。 rm -rf * 删除所有文件及目录 rmdir 删除空目录。只可以删除空目录。 ln 创建硬链接或软链接,硬链接=同一文件的多个名字;软链接=快捷方式 用法 ln [-f] [-n] [-s] f1 [f2] ln [-f] [-n] [-s] f1 ... fn d1 ln [-f] [-n] -s d1 d2 ln file1 file1.ln 创建硬链接。感觉是同一文件,删除一个,对另一个没有影响;须两个都删除才算删除。 ln -s file1 file1.sln 创建软链接。可跨系统操作,冲破操作权限;也是快捷方式。 八、时间显示 date 显示时间,精确到秒 用法 date [-u] mmddHHMM[[cc]yy][.SS] date [-u] [+format] date -a [-]sss[.fff] cal 显示日历 cal 9 2008 显示2008年9月的日历; cal 显示当月的 用法 cal [ [月] 年 ] 九、帮助 man 帮助( format and display the on-line manual pages) 用法 man [-] [-adFlrt] [-M 路径] [-T 宏软件包] [-s 段] 名称 ... man [-] [-adFlrt] [-M path] [-T macro-package] [-s section] name... man [-M 路径] -k 关键字 ... man [-M 路径] -f 文件 ... awk 按一定格式输出(pattern scanning and processing language) 用法 awk [-Fc] [-f 源代码 | 'cmds'] [文件] 十、vi 底行模式 /? 命令模式 i a o 输入模式 vi 的使用方法 1、光标 h 左 j 下 k 上 l 右 set nu 显示行号(set nonu) 21 光标停在指定行 21G 第N行 (G到文件尾,1G到文件头) 如果要将光标移动到文件第一行,那么就按 1G H 屏幕头 M 屏幕间 L 屏幕底 ^ 或 shift+6 行首 $ 或 shift+4 行尾 Ctrl+f 下翻 Ctrl+b 上翻 2、输入 (输入模式) o 光标往下换一行 O (大写字母o)在光标所在行上插入一空行 i 在光标所在位置的前面插入字母 a 在光标所在位置的后面插入一个新字母 退出插入状态。 3、修改替换 r 替换一个字符 dd 删除行,剪切行 (5dd删除5行) 5,10d 删除 5 至 10 行(包括第 5行和第 10 行) x 删除一个字符 dw 删除词,剪切词。 ( 3dw删除 3 单词) cw 替换一个单词。 (cw 和 dw 的区别 cw 删除某一个单词后直接进入编辑模式,而dw删除词后仍处于命令模式) cc 替换一行 C 替换从光标到行尾 yy 复制行 (用法同下的 Y ,见下行) Y 将光标移动到要复制行位置,按yy。当你想粘贴的时候,请将光标移动到你想复制的位置的前一个位置,然后按 p yw 复制词 p 当前行下粘贴 1,2co3 复制行1,2在行3之后 4,5m6 移动行4,5在行6之后 u 当你的前一个命令操作是一个误操作的时候,那么可以按一下 u键,即可复原。只能撤销一次 r file2 在光标所在处插入另一个文件 ~ 将字母变成大写 J 可以将当前行与下一行连接起来 /字符串 从上往下找匹配的字符串 ?字符串 从下往上找匹配的字符串 n 继续查找 1,$s/旧串/新串/g 替换全文(或者 %s/旧串/新串/g) (1表示从第一行开始) 没有g则只替换一次,加g替换所有 3、存盘和退出 w 存盘 w newfile 存成新文件 wq 存盘再退出VI(或者ZZ或 X) q! 强行退出不存盘 查看用户 users 显示在线用户(仅显示用户名)。 who 显示在线用户,但比users更详细,包括用户名、终端号、登录时间、IP地址。 who am i 仅显示自己,(但包括用户名、端口、登录时间、IP地址;信息量=who)。 whoami 也仅显示自己,但只有用户名(仅显示自己的有效的用户名)。 w 显示比who更多内容,还包括闲置时间、占CPU、平均占用CPU、执行命令。 用法 w [ -hlsuw ] [ 用户 ] su 改变用户,需再输入密码。 用法 su [-] [ username [ arg ... ] ] su - 相当于退出再重新登录。 查找 find 查找文件 用法 find [-H | -L] 路径列表 谓词列表 find / -name perl 从根目录开始查找名为perl的文件。 find . -mtime 10 -print 从当前目录查找距离现在10天时修改的文件,显示在屏幕上。 (注 “10”表示第10天的时候;如果是“+10”表示10天以外的范围;“-10”表示10天以内的范围。) grep 文件查找字符;有过滤功能,只列出想要的内容 用法 grep -hblcnsviw 模式 文件 . . . 如 grep abc /etc/passwd 在passwd文件下找abc字符 wc 统计 -l 统计行数; -w统计单词数; -c 统计字符数 如 grep wang /etc/passwd|wc -l 统计passwd文件含“wang”的行数 du 查看目录情况 如 du -sk * 不加-s会显示子目录,-k按千字节排序 用法 du [-a] [-d] [-h|-k] [-r] [-o|-s] [-H|-L] [文件...] 进程管理 ps 显示进程。 用法 ps [ -aAdeflcjLPyZ ] [ -o 格式 ] [ -t 项列表 ] [ -u 用户列表 ] [ -U 用户列表 ] [ -G 组列表 ] [ -p 进程列表 ] [ -g 程序组列表 ] [ -s 标识符列表 ] [ -z 区域列表 ] ps 显示自己的进程。 ps -e 显示每个进程,包括空闲进程。 ps -f 显示详情。 ps -ef 组合-e和-f,所有进程的详情。 ps -U uidlist(用户列表) 具体查看某人的进程。 kill pkill sleep jobs 用法 jobs [-l ] fg %n bg %n stop %n 挂起(仅csh能用) Ctrl+C Ctrl+Z 网络链接 ping usage ping host [timeout] usage ping -s [-l | U] [adLnRrv] [-A addr_family] [-c traffic_class] [-g gateway [-g gateway ...]] [-F flow_label] [-I interval] [-i interface] [-P tos] [-p port] [-t ttl] host [data_size] [npackets] ifconfig -a /sbin/ifconfig 查看本机的IP地址 netstat -rn rlogin ftp 帮助文件 [sd0807@localhost ~]$ help GNU bash, version 3.1.17(1)-release (i686-redhat-linux-gnu) These shell commands are defined internally. Type `help' to see this list. Type `help name' to find out more about the function `name'. Use `info bash' to find out more about the shell in general. Use `man -k' or `info' to find out more about commands not in this list. A star (*) next to a name means that the command is disabled. JOB_SPEC [&] (( expression )) . filename [arguments] [ arg... ] [[ expression ]] alias [-p] [name[=value] ... ] bg [job_spec ...] bind [-lpvsPVS] [-m keymap] [-f fi break [n] builtin [shell-builtin [arg ...]] caller [EXPR] case WORD in [PATTERN [| PATTERN]. cd [-L|-P] [dir] command [-pVv] command [arg ...] compgen [-abcdefgjksuv] [-o option complete [-abcdefgjksuv] [-pr] [-o continue [n] declare [-afFirtx] [-p] [name[=val dirs [-clpv] [+N] [-N] disown [-h] [-ar] [jobspec ...] echo [-neE] [arg ...] enable [-pnds] [-a] [-f filename] eval [arg ...] exec [-cl] [-a name] file [redirec exit [n] export [-nf] [name[=value] ...] or false fc [-e ename] [-nlr] [first] [last fg [job_spec] for NAME [in WORDS ... ;] do COMMA for (( exp1; exp2; exp3 )); do COM function NAME { COMMANDS ; } or NA getopts optstring name [arg] hash [-lr] [-p pathname] [-dt] [na help [-s] [pattern ...] history [-c] [-d offset] [n] or hi if COMMANDS; then COMMANDS; [ elif jobs [-lnprs] [jobspec ...] or job kill [-s sigspec | -n signum | -si let arg [arg ...] local name[=value] ... logout popd [+N | -N] [-n] printf [-v var] format [arguments] pushd [dir | +N | -N] [-n] pwd [-LP] read [-ers] [-u fd] [-t timeout] [ readonly [-af] [name[=value] ...] return [n] select NAME [in WORDS ... ;] do CO set [--abefhkmnptuvxBCHP] [-o option] [arg ...] shift [n] shopt [-pqsu] [-o long-option] opt source filename [arguments] suspend [-f] test [expr] time [-p] PIPELINE times trap [-lp] [arg signal_spec ...] true type [-afptP] name [name ...] typeset [-afFirtx] [-p] name[=valu ulimit [-SHacdfilmnpqstuvx] [limit umask [-p] [-S] [mode] unalias [-a] name [name ...] unset [-f] [-v] [name ...] until COMMANDS; do COMMANDS; done variables - Some variable names an wait [n] while COMMANDS; do COMMANDS; done { COMMANDS ; } 输入 man help BASH_BUILTINS(1) BASH_BUILTINS(1) NAME bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen, complete, continue, declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, type, typeset, ulimit, umask, una- lias, unset, wait - bash built-in commands, see bash(1) BASH BUILTIN COMMANDS Unless otherwise noted, each builtin command documented in this section as accepting options preceded by - accepts -- to signify the end of the options. For example, the :, true, false, and test builtins do not accept options. : [arguments] No effect; the command does nothing beyond expanding arguments and performing any specified redirections. A zero exit code is returned. . filename [arguments] source filename [arguments] Read and execute commands from filename in the current shell environment and return the exit status of the last command executed from filename. If filename does not contain a slash, file names in PATH are used to find the directory containing file- name. The file searched for in PATH need not be executable. When bash is not in posix mode, the current directory is searched if no file is found in PATH. If the sourcepath option to the shopt builtin command is turned off, the PATH is not searched. If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if filename is not found or cannot be read. alias [-p] [name[=value] ...] Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution when the alias is expanded. For each name in the argument list for which no value is supplied, the name and value of the alias is printed. Alias returns true unless a name is given for which no alias has been defined. bg [jobspec ...] Resume each suspended job jobspec in the background, as if it had been started with &. If jobspec is not present, the shell’s notion of the current job is used. bg jobspec returns 0 unless run when job control is disabled or, when run with job con- trol enabled, any specified jobspec was not found or was started without job control. bind [-m keymap] [-lpsvPSV] bind [-m keymap] [-q function] [-u function] [-r keyseq] bind [-m keymap] -f filename bind [-m keymap] -x keyseq:shell-command bind [-m keymap] keyseq:function-name bind readline-command Display current readline key and function bindings, bind a key sequence to a readline function or macro, or set a readline variable. Each non-option argument is a command as it would appear in .inputrc, but each binding or command must be passed as a sepa- rate argument; e.g., ’"\C-x\C-r": re-read-init-file’. Options, if supplied, have the following meanings: -m keymap Use keymap as the keymap to be affected by the subsequent bindings. Accept- able keymap names are emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert. vi is equivalent to vi-command; emacs is equivalent to emacs-standard. -l List the names of all readline functions. -p Display readline function names and bindings in such a way that they can be re-read. -P List current readline function names and bindings. -v Display readline variable names and values in such a way that they can be re- read. -V List current readline variable names and values. -s Display readline key sequences bound to macros and the strings they output in such a way that they can be re-read. -S Display readline key sequences bound to macros and the strings they output. -f filename Read key bindings from filename. -q function Query about which keys invoke the named function. -u function Unbind all keys bound to the named function. -r keyseq Remove any current binding for keyseq. -x keyseq:shell-command Cause shell-command to be executed whenever keyseq is entered. The return value is 0 unless an unrecognized option is given or an error occurred. break [n] Exit from within a for, while, until, or select loop. If n is specified, break n levels. n must be ≥ 1. If n is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless the shell is not executing a loop when break is executed. builtin shell-builtin [arguments] Execute the specified shell builtin, passing it arguments, and return its exit sta- tus. This is useful when defining a function whose name is the same as a shell builtin, retaining the functionality of the builtin within the function. The cd builtin is commonly redefined this way. The return status is false if shell-builtin is not a shell builtin command. cd [-L|-P] [dir] Change the current directory to dir. The variable HOME is the default dir. The variable CDPATH defines the search path for the directory containing dir. Alterna- tive directory names in CDPATH are separated by a colon (:). A null directory name in CDPATH is the same as the current directory, i.e., ‘‘.’’. If dir begins with a slash (/), then CDPATH is not used. The -P option says to use the physical directory structure instead of following symbolic links (see also the -P option to the set builtin command); the -L option forces symbolic links to be followed. An argument of - is equivalent to $OLDPWD. If a non-empty directory name from CDPATH is used, or if - is the first argument, and the directory change is successful, the absolute path- name of the new working directory is written to the standard output. The return value is true if the directory was successfully changed; false otherwise. caller [expr] Returns the context of any active subroutine call (a shell function or a script exe- cuted with the . or source builtins. Without expr, caller displays the line number and source filename of the current subroutine call. If a non-negative integer is supplied as expr, caller displays the line number, subroutine name, and source file corresponding to that position in the current execution call stack. This extra information may be used, for example, to print a stack trace. The current frame is frame 0. The return value is 0 unless the shell is not executing a subroutine call or expr does not correspond to a valid position in the call stack. command [-pVv] command [arg ...] Run command with args suppressing the normal shell function lookup. Only builtin com- mands or commands found in the PATH are executed. If the -p option is given, the search for command is performed using a default value for PATH that is guaranteed to find all of the standard utilities. If either the -V or -v option is supplied, a description of command is printed. The -v option causes a single word indicating the command or file name used to invoke command to be displayed; the -V option produces a more verbose description. If the -V or -v option is supplied, the exit status is 0 if command was found, and 1 if not. If neither option is supplied and an error occurred or command cannot be found, the exit status is 127. Otherwise, the exit status of the command builtin is the exit status of command. compgen [option] [word] Generate possible completion matches for word according to the options, which may be any option accepted by the complete builtin with the exception of -p and -r, and write the matches to the standard output. When using the -F or -C options, the vari- ous shell variables set by the programmable completion facilities, while available, will not have useful values. The matches will be generated in the same way as if the programmable completion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word will be displayed. The return value is true unless an invalid option is supplied, or no matches were generated. complete [-abcdefgjksuv] [-o comp-option] [-A action] [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function] [-C command] name [name ...] complete -pr [name ...] Specify how arguments to each name should be completed. If the -p option is sup- plied, or if no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. The -r option removes a completion specification for each name, or, if no names are supplied, all completion specifica- tions. The process of applying these completion specifications when word completion is attempted is described above under Programmable Completion. Other options, if specified, have the following meanings. The arguments to the -G, -W, and -X options (and, if necessary, the -P and -S options) should be quoted to protect them from expansion before the complete builtin is invoked. -o comp-option The comp-option controls several aspects of the compspec’s behavior beyond the simple generation of completions. comp-option may be one of: bashdefault Perform the rest of the default bash completions if the compspec gen- erates no matches. default Use readline’s default filename completion if the compspec generates no matches. dirnames Perform directory name completion if the compspec generates no matches. filenames Tell readline that the compspec generates filenames, so it can per- form any filename-specific processing (like adding a slash to direc- tory names or suppressing trailing spaces). Intended to be used with shell functions. nospace Tell readline not to append a space (the default) to words completed at the end of the line. plusdirs After any matches defined by the compspec are generated, directory name completion is attempted and any matches are added to the results of the other actions. -A action The action may be one of the following to generate a list of possible comple- tions: alias Alias names. May also be specified as -a. arrayvar Array variable names. binding Readline key binding names. builtin Names of shell builtin commands. May also be specified as -b. command Command names. May also be specified as -c. directory Directory names. May also be specified as -d. disabled Names of disabled shell builtins. enabled Names of enabled shell builtins. export Names of exported shell variables. May also be specified as -e. file File names. May also be specified as -f. function Names of shell functions. group Group names. May also be specified as -g. helptopic Help topics as accepted by the help builtin. hostname Hostnames, as taken from the file specified by the HOSTFILE shell variable. job Job names, if job control is active. May also be specified as -j. keyword Shell reserved words. May also be specified as -k. running Names of running jobs, if job control is active. service Service names. May also be specified as -s. setopt Valid arguments for the -o option to the set builtin. shopt Shell option names as accepted by the shopt builtin. signal Signal names. stopped Names of stopped jobs, if job control is active. user User names. May also be specified as -u. variable Names of all shell variables. May also be specified as -v. -G globpat The filename expansion pattern globpat is expanded to generate the possible completions. -W wordlist The wordlist is split using the characters in the IFS special variable as delimiters, and each resultant word is expanded. The possible completions are the members of the resultant list which match the word being completed. -C command command is executed in a subshell environment, and its output is used as the possible completions. -F function The shell function function is executed in the current shell environment. When it finishes, the possible completions are retrieved from the value of the COMPREPLY array variable. -X filterpat filterpat is a pattern as used for filename expansion. It is applied to the list of possible completions generated by the preceding options and argu- ments, and each completion matching filterpat is removed from the list. A leading ! in filterpat negates the pattern; in this case, any completion not matching filterpat is removed. -P prefix prefix is added at the beginning of each possible completion after all other options have been applied. -S suffix suffix is appended to each possible completion after all other options have been applied. The return value is true unless an invalid option is supplied, an option other than -p or -r is supplied without a name argument, an attempt is made to remove a comple- tion specification for a name for which no specification exists, or an error occurs adding a completion specification. continue [n] Resume the next iteration of the enclosing for, while, until, or select loop. If n is specified, resume at the nth enclosing loop. n must be ≥ 1. If n is greater than the number of enclosing loops, the last enclosing loop (the ‘‘top-level’’ loop) is resumed. The return value is 0 unless the shell is not executing a loop when con- tinue is executed. declare [-afFirtx] [-p] [name[=value] ...] typeset [-afFirtx] [-p] [name[=value] ...] Declare variables and/or give them attributes. If no names are given then display the values of variables. The -p option will display the attributes and values of each name. When -p is used, additional options are ignored. The -F option inhibits the display of function definitions; only the function name and attributes are printed. If the extdebug shell option is enabled using shopt, the source file name and line number where the function is defined are displayed as well. The -F option implies -f. The following options can be used to restrict output to variables with the specified attribute or to give variables attributes: -a Each name is an array variable (see Arrays above). -f Use function names only. -i The variable is treated as an integer; arithmetic evaluation (see ARITHMETIC EVALUATION ) is performed when the variable is assigned a value. -r Make names readonly. These names cannot then be assigned values by subsequent assignment statements or unset. -t Give each name the trace attribute. Traced functions inherit the DEBUG and RETURN traps from the calling shell. The trace attribute has no special mean- ing for variables. -x Mark names for export to subsequent commands via the environment. Using ‘+’ instead of ‘-’ turns off the attribute instead, with the exception that +a may not be used to destroy an array variable. When used in a function, makes each name local, as with the local command. If a variable name is followed by =value, the value of the variable is set to value. The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using ‘‘-f foo=bar’’, an attempt is made to assign a value to a readonly variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax (see Arrays above), one of the names is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-exis- tent function with -f. dirs [-clpv] [+n] [-n] Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the pushd command; the popd command removes entries from the list. +n Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero. -n Displays the nth entry counting from the right of the list shown by dirs when invoked without options, starting with zero. -c Clears the directory stack by deleting all of the entries. -l Produces a longer listing; the default listing format uses a tilde to denote the home directory. -p Print the directory stack with one entry per line. -v Print the directory stack with one entry per line, prefixing each entry with its index in the stack. The return value is 0 unless an invalid option is supplied or n indexes beyond the end of the directory stack. disown [-ar] [-h] [jobspec ...] Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used. If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job. echo [-neE] [arg ...] Output the args, separated by spaces, followed by a newline. The return status is always 0. If -n is specified, the trailing newline is suppressed. If the -e option is given, interpretation of the following backslash-escaped characters is enabled. The -E option disables the interpretation of these escape characters, even on systems where they are interpreted by default. The xpg_echo shell option may be used to dynamically determine whether or not echo expands these escape characters by default. echo does not interpret -- to mean the end of options. echo interprets the following escape sequences: \a alert (bell) \b backspace \c suppress trailing newline \e an escape character \f form feed \n new line \r carriage return \t horizontal tab \v vertical tab \\ backslash \0nnn the eight-bit character whose value is the octal value nnn (zero to three octal digits) \nnn the eight-bit character whose value is the octal value nnn (one to three octal digits) \xHH the eight-bit character whose value is the hexadecimal value HH (one or two hex digits) enable [-adnps] [-f filename] [name ...] Enable and disable builtin shell commands. Disabling a builtin allows a disk command which has the same name as a shell builtin to be executed without specifying a full pathname, even though the shell normally searches for builtins before disk commands. If -n is used, each name is disabled; otherwise, names are enabled. For example, to use the test binary found via the PATH instead of the shell builtin version, run ‘‘enable -n test’’. The -f option means to load the new builtin command name from shared object filename, on systems that support dynamic loading. The -d option will delete a builtin previously loaded with -f. If no name arguments are given, or if the -p option is supplied, a list of shell builtins is printed. With no other option arguments, the list consists of all enabled shell builtins. If -n is supplied, only disabled builtins are printed. If -a is supplied, the list printed includes all builtins, with an indication of whether or not each is enabled. If -s is supplied, the output is restricted to the POSIX special builtins. The return value is 0 unless a name is not a shell builtin or there is an error loading a new builtin from a shared object. eval [arg ...] The args are read and concatenated together into a single command. This command is then read and executed by the shell, and its exit status is returned as the value of eval. If there are no args, or only null arguments, eval returns 0. exec [-cl] [-a name] [command [arguments]] If command is specified, it replaces the shell. No new process is created. The arguments become the arguments to command. If the -l option is supplied, the shell places a dash at the beginning of the zeroth arg passed to command. This is what login(1) does. The -c option causes command to be executed with an empty environ- ment. If -a is supplied, the shell passes name as the zeroth argument to the exe- cuted command. If command cannot be executed for some reason, a non-interactive shell exits, unless the shell option execfail is enabled, in which case it returns failure. An interactive shell returns failure if the file cannot be executed. If command is not specified, any redirections take effect in the current shell, and the return status is 0. If there is a redirection error, the return status is 1. exit [n] Cause the shell to exit with a status of n. If n is omitted, the exit status is that of the last command executed. A trap on EXIT is executed before the shell termi- nates. export [-fn] [name[=word]] ... export -p The supplied names are marked for automatic export to the environment of subsequently executed commands. If the -f option is given, the names refer to functions. If no names are given, or if the -p option is supplied, a list of all names that are exported in this shell is printed. The -n option causes the export property to be removed from each name. If a variable name is followed by =word, the value of the variable is set to word. export returns an exit status of 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is sup- plied with a name that is not a function. fc [-e ename] [-nlr] [first] [last] fc -s [pat=rep] [cmd] Fix Command. In the first form, a range of commands from first to last is selected from the history list. First and last may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). If last is not specified it is set to the current command for listing (so that ‘‘fc -l -10’’ prints the last 10 commands) and to first otherwise. If first is not speci- fied it is set to the previous command for editing and -16 for listing. The -n option suppresses the command numbers when listing. The -r option reverses the order of the commands. If the -l option is given, the commands are listed on standard output. Otherwise, the editor given by ename is invoked on a file contain- ing those commands. If ename is not given, the value of the FCEDIT variable is used, and the value of EDITOR if FCEDIT is not set. If neither variable is set, is used. When editing is complete, the edited commands are echoed and executed. In the second form, command is re-executed after each instance of pat is replaced by rep. A useful alias to use with this is ‘‘r="fc -s"’’, so that typing ‘‘r cc’’ runs the last command beginning with ‘‘cc’’ and typing ‘‘r’’ re-executes the last command. If the first form is used, the return value is 0 unless an invalid option is encoun- tered or first or last specify history lines out of range. If the -e option is sup- plied, the return value is the value of the last command executed or failure if an error occurs with the temporary file of commands. If the second form is used, the return status is that of the command re-executed, unless cmd does not specify a valid history line, in which case fc returns failure. fg [jobspec] Resume jobspec in the foreground, and make it the current job. If jobspec is not present, the shell’s notion of the current job is used. The return value is that of the command placed into the foreground, or failure if run when job control is dis- abled or, when run with job control enabled, if jobspec does not specify a valid job or jobspec specifies a job that was started without job control. getopts optstring name [args] getopts is used by shell procedures to parse positional parameters. optstring con- tains the option characters to be recognized; if a character is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. The colon and question mark characters may not be used as option char- acters. Each time it is invoked, getopts places the next option in the shell vari- able name, initializing name if it does not exist, and the index of the next argument to be processed into the variable OPTIND. OPTIND is initialized to 1 each time the shell or a shell script is invoked. When an option requires an argument, getopts places that argument into the variable OPTARG. The shell does not reset OPTIND auto- matically; it must be manually reset between multiple calls to getopts within the same shell invocation if a new set of parameters is to be used. When the end of options is encountered, getopts exits with a return value greater than zero. OPTIND is set to the index of the first non-option argument, and name is set to ?. getopts normally parses the positional parameters, but if more arguments are given in args, getopts parses those instead. getopts can report errors in two ways. If the first character of optstring is a colon, silent error reporting is used. In normal operation diagnostic messages are printed when invalid options or missing option arguments are encountered. If the variable OPTERR is set to 0, no error messages will be displayed, even if the first character of optstring is not a colon. If an invalid option is seen, getopts places ? into name and, if not silent, prints an error message and unsets OPTARG. If getopts is silent, the option character found is placed in OPTARG and no diagnostic message is printed. If a required argument is not found, and getopts is not silent, a question mark (?) is placed in name, OPTARG is unset, and a diagnostic message is printed. If getopts is silent, then a colon (:) is placed in name and OPTARG is set to the option charac- ter found. getopts returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs. hash [-lr] [-p filename] [-dt] [name] For each name, the full file name of the command is determined by searching the directories in $PATH and remembered. If the -p option is supplied, no path search is performed, and filename is used as the full file name of the command. The -r option causes the shell to forget all remembered locations. The -d option causes the shell to forget the remembered location of each name. If the -t option is supplied, the full pathname to which each name corresponds is printed. If multiple name arguments are supplied with -t, the name is printed before the hashed full pathname. The -l option causes output to be displayed in a format that may be reused as input. If no arguments are given, or if only -l is supplied, information about remembered commands is printed. The return status is true unless a name is not found or an invalid option is supplied. help [-s] [pattern] Display helpful information about builtin commands. If pattern is specified, help gives detailed help on all commands matching pattern; otherwise help for all the builtins and shell control structures is printed. The -s option restricts the infor- mation displayed to a short usage synopsis. The return status is 0 unless no command matches pattern. history [n] history -c history -d offset history -anrw [filename] history -p arg [arg ...] history -s arg [arg ...] With no options, display the command history list with line numbers. Lines listed with a * have been modified. An argument of n lists only the last n lines. If the shell variable HISTTIMEFORMAT is set and not null, it is used as a format string for strftime(3) to display the time stamp associated with each displayed history entry. No intervening blank is printed between the formatted time stamp and the history line. If filename is supplied, it is used as the name of the history file; if not, the value of HISTFILE is used. Options, if supplied, have the following meanings: -c Clear the history list by deleting all the entries. -d offset Delete the history entry at position offset. -a Append the ‘‘new’’ history lines (history lines entered since the beginning of the current bash session) to the history file. -n Read the history lines not already read from the history file into the current history list. These are lines appended to the history file since the begin- ning of the current bash session. -r Read the contents of the history file and use them as the current history. -w Write the current history to the history file, overwriting the history file’s contents. -p Perform history substitution on the following args and display the result on the standard output. Does not store the results in the history list. Each arg must be quoted to disable normal history expansion. -s Store the args in the history list as a single entry. The last command in the history list is removed before the args are added. If the HISTTIMEFORMAT is set, the time stamp information associated with each history entry is written to the history file. The return value is 0 unless an invalid option is encountered, an error occurs while reading or writing the history file, an invalid offset is supplied as an argument to -d, or the history expansion supplied as an argument to -p fails. jobs [-lnprs] [ jobspec ... ] jobs -x command [ args ... ] The first form lists the active jobs. The options have the following meanings: -l List process IDs in addition to the normal information. -p List only the process ID of the job’s process group leader. -n Display information only about jobs that have changed status since the user was last notified of their status. -r Restrict output to running jobs. -s Restrict output to stopped jobs. If jobspec is given, output is restricted to information about that job. The return status is 0 unless an invalid option is encountered or an invalid jobspec is sup- plied. If the -x option is supplied, jobs replaces any jobspec found in command or args with the corresponding process group ID, and executes command passing it args, returning its exit status. kill [-s sigspec | -n signum | -sigspec] [pid | jobspec] ... kill -l [sigspec | exit_status] Send the signal named by sigspec or signum to the processes named by pid or jobspec. sigspec is either a case-insensitive signal name such as SIGKILL (with or without the SIG prefix) or a signal number; signum is a signal number. If sigspec is not present, then SIGTERM is assumed. An argument of -l lists the signal names. If any arguments are supplied when -l is given, the names of the signals corresponding to the arguments are listed, and the return status is 0. The exit_status argument to -l is a number specifying either a signal number or the exit status of a process termi- nated by a signal. kill returns true if at least one signal was successfully sent, or false if an error occurs or an invalid option is encountered. let arg [arg ...] Each arg is an arithmetic expression to be evaluated (see ARITHMETIC EVALUATION). If the last arg evaluates to 0, let returns 1; 0 is returned otherwise. local [option] [name[=value] ...] For each argument, a local variable named name is created, and assigned value. The option can be any of the options accepted by declare. When local is used within a function, it causes the variable name to have a visible scope restricted to that function and its children. With no operands, local writes a list of local variables to the standard output. It is an error to use local when not within a function. The return status is 0 unless local is used outside a function, an invalid name is sup- plied, or name is a readonly variable. logout Exit a login shell. popd [-n] [+n] [-n] Removes entries from the directory stack. With no arguments, removes the top direc- tory from the stack, and performs a cd to the new top directory. Arguments, if sup- plied, have the following meanings: +n Removes the nth entry counting from the left of the list shown by dirs, start- ing with zero. For example: ‘‘popd +0’’ removes the first directory, ‘‘popd +1’’ the second. -n Removes the nth entry counting from the right of the list shown by dirs, starting with zero. For example: ‘‘popd -0’’ removes the last directory, ‘‘popd -1’’ the next to last. -n Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. If the popd command is successful, a dirs is performed as well, and the return status is 0. popd returns false if an invalid option is encountered, the directory stack is empty, a non-existent directory stack entry is specified, or the directory change fails. printf [-v var] format [arguments] Write the formatted arguments to the standard output under the control of the format. The format is a character string which contains three types of objects: plain charac- ters, which are simply copied to standard output, character escape sequences, which are converted and copied to the standard output, and format specifications, each of which causes printing of the next successive argument. In addition to the standard printf(1) formats, %b causes printf to expand backslash escape sequences in the cor- responding argument (except that \c terminates output, backslashes in \', \", and \? are not removed, and octal escapes beginning with \0 may contain up to four digits), and %q causes printf to output the corresponding argument in a format that can be reused as shell input. The -v option causes the output to be assigned to the variable var rather than being printed to the standard output. The format is reused as necessary to consume all of the arguments. If the format requires more arguments than are supplied, the extra format specifications behave as if a zero value or null string, as appropriate, had been supplied. The return value is zero on success, non-zero on failure. pushd [-n] [dir] pushd [-n] [+n] [-n] Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty. Arguments, if supplied, have the following meanings: +n Rotates the stack so that the nth directory (counting from the left of the list shown by dirs, starting with zero) is at the top. -n Rotates the stack so that the nth directory (counting from the right of the list shown by dirs, starting with zero) is at the top. -n Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. dir Adds dir to the directory stack at the top, making it the new current working directory. If the pushd command is successful, a dirs is performed as well. If the first form is used, pushd returns 0 unless the cd to dir fails. With the second form, pushd returns 0 unless the directory stack is empty, a non-existent directory stack element is specified, or the directory change to the specified new current directory fails. pwd [-LP] Print the absolute pathname of the current working directory. The pathname printed contains no symbolic links if the -P option is supplied or the -o physical option to the set builtin command is enabled. If the -L option is used, the pathname printed may contain symbolic links. The return status is 0 unless an error occurs while reading the name of the current directory or an invalid option is supplied. read [-ers] [-u fd] [-t timeout] [-a aname] [-p prompt] [-n nchars] [-d delim] [name ...] One line is read from the standard input, or from the file descriptor fd supplied as an argument to the -u option, and the first word is assigned to the first name, the second word to the second name, and so on, with leftover words and their intervening separators assigned to the last name. If there are fewer words read from the input stream than names, the remaining names are assigned empty values. The characters in IFS are used to split the line into words. The backslash character (\) may be used to remove any special meaning for the next character read and for line continuation. Options, if supplied, have the following meanings: -a aname The words are assigned to sequential indices of the array variable aname, starting at 0. aname is unset before any new values are assigned. Other name arguments are ignored. -d delim The first character of delim is used to terminate the input line, rather than newline. -e If the standard input is coming from a terminal, readline (see READLINE above) is used to obtain the line. -n nchars read returns after reading nchars characters rather than waiting for a com- plete line of input. -p prompt Display prompt on standard error, without a trailing newline, before attempt- ing to read any input. The prompt is displayed only if input is coming from a terminal. -r Backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. -s Silent mode. If input is coming from a terminal, characters are not echoed. -t timeout Cause read to time out and return failure if a complete line of input is not read within timeout seconds. This option has no effect if read is not reading input from the terminal or a pipe. -u fd Read input from file descriptor fd. If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero, unless end-of-file is encountered, read times out, or an invalid file descriptor is supplied as the argument to -u. readonly [-apf] [name[=word] ...] The given names are marked readonly; the values of these names may not be changed by subsequent assignment. If the -f option is supplied, the functions corresponding to the names are so marked. The -a option restricts the variables to arrays. If no name arguments are given, or if the -p option is supplied, a list of all readonly names is printed. The -p option causes output to be displayed in a format that may be reused as input. If a variable name is followed by =word, the value of the vari- able is set to word. The return status is 0 unless an invalid option is encountered, one of the names is not a valid shell variable name, or -f is supplied with a name that is not a function. return [n] Causes a function to exit with the return value specified by n. If n is omitted, the return status is that of the last command executed in the function body. If used outside a function, but during execution of a script by the . (source) command, it causes the shell to stop executing that script and return either n or the exit status of the last command executed within the script as the exit status of the script. If used outside a function and not during execution of a script by ., the return status is false. Any command associated with the RETURN trap is executed before execution resumes after the function or script. set [--abefhkmnptuvxBCHP] [-o option] [arg ...] Without options, the name and value of each shell variable are displayed in a format that can be reused as input for setting or resetting the currently-set variables. Read-only variables cannot be reset. In posix mode, only shell variables are listed. The output is sorted according to the current locale. When options are specified, they set or unset shell attributes. Any arguments remaining after the options are processed are treated as values for the positional parameters and are assigned, in order, to $1, $2, ... $n. Options, if specified, have the following meanings: -a Automatically mark variables and functions which are modified or created for export to the environment of subsequent commands. -b Report the status of terminated background jobs immediately, rather than before the next primary prompt. This is effective only when job control is enabled. -e Exit immediately if a simple command (see SHELL GRAMMAR above) exits with a non-zero status. The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of a && or ││ list, or if the command’s return value is being inverted via !. A trap on ERR, if set, is executed before the shell exits. -f Disable pathname expansion. -h Remember the location of commands as they are looked up for execution. This is enabled by default. -k All arguments in the form of assignment statements are placed in the environ- ment for a command, not just those that precede the command name. -m Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it (see JOB CONTROL above). Back- ground processes run in a separate process group and a line containing their exit status is printed upon their completion. -n Read commands but do not execute them. This may be used to check a shell script for syntax errors. This is ignored by interactive shells. -o option-name The option-name can be one of the following: allexport Same as -a. braceexpand Same as -B. emacs Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the --noediting option. errtrace Same as -E. functrace Same as -T. errexit Same as -e. hashall Same as -h. histexpand Same as -H. history Enable command history, as described above under HISTORY. This option is on by default in interactive shells. ignoreeof The effect is as if the shell command ‘‘IGNOREEOF=10’’ had been exe- cuted (see Shell Variables above). keyword Same as -k. monitor Same as -m. noclobber Same as -C. noexec Same as -n. noglob Same as -f. nolog Currently ignored. notify Same as -b. nounset Same as -u. onecmd Same as -t. physical Same as -P. pipefail If set, the return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status, or zero if all command

609

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder DataWindow
社区管理员
  • DataWindow社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧