script可用来记录执行过的所有命令及命令的输出, 和sqlplus中的spool命令很相似. 启动格式为
[code]script logfilename[/code]
logfilename为记录文件的名称, 如果不指定logfilename, 则记录到当前目录下的typescript文件中 退出命令为exit.
下面是使用script的一个示例:
[code]blue_stone@blueice:~/nb$ script ls.log
Script started, file is ls.log
blue_stone@blueice:~/nb$ ls -al
总计 36
drwxrwxrwx 5 blue_stone user 4096 2006-09-14 23:13 .
drwxr-sr-x 131 blue_stone user 8192 2006-09-14 22:45 ..
drwxrwxrwx 34 blue_stone user 4096 2006-09-06 00:06 doc
-rw-r--r-- 1 blue_stone user 0 2006-09-14 23:13 ls.log
drwxr-xr-x 13 root root 4096 2006-08-19 09:40 personal
drwxr-xr-x 23 root root 4096 2005-04-23 15:06 projects
blue_stone@blueice:~/nb$ exit
Script done, file is ls.log[/code]
生成的ls.log文件如下:
[code]Script started on 2006年09月14日 星期四 23时13分36秒
blue_stone@blueice:~/nb$ ls -al
总计 36
drwxrwxrwx 5 blue_stone user 4096 2006-09-14 23:13 .
drwxr-sr-x 131 blue_stone user 8192 2006-09-14 22:45 ..
drwxrwxrwx 34 blue_stone user 4096 2006-09-06 00:06 doc
-rw-r--r-- 1 blue_stone user 0 2006-09-14 23:13 ls.log
drwxr-xr-x 13 root root 4096 2006-08-19 09:40 personal
drwxr-xr-x 23 root root 4096 2005-04-23 15:06 projects
blue_stone@blueice:~/nb$ exit
Script done on 2006年09月14日 星期四 23时13分39秒[/code]
如果在做重要操作之前, 运行script, 能把所有的操作及输出记录下来, 较之bash的命令记录功能, 则又上一层了.

