除此以外,unix的哲学是一个程序只做一件事情并做到最好,其它的功能留给其它的程序去做。就如同 tar,它只是负责打包,甚至连压缩都不负责,压缩部分它交给 gzip, bzip, lzma等工具去做。至于处理多个文件,它也不会去管,而是交给 shell 去做。这同 windows 的一个工具大而全完全不同。unix 在做 GUI 的时候,就比较方便,你可以自由的集成各种小工具,以达到更复杂的功能。比如图形界面的存档管理器,就可以很方便的处理多个文件的压缩、解压缩。
2010/8/5 Quinn Li <[email protected]> > 因为tar命令的格式是tar [options] [files to > extract],tar后面可以跟多个文件名作参数,但参数含义不是tar包的文件名,而是需要解压的tar包中的文件名。 > > 如果tar要支持解压多个文件,还需保留上述功能,可能要实现成这样 > tar -f tar1 [options for tar1] [files in tar1] -f tar2 [options for > tar2] [files in tar2] > > 参数解析不是一般的麻烦,而且这种命令行格式,还需要根据参数的先后顺序决定含义,又增加了参数解析复杂度。 > > 2010/8/5 User <[email protected]> > >> >> >> 2010-08-05(Thursday) 19:22:09 +0800, Quinn Li <[email protected]>: >> >> > 可以用xargs组合 >> > >> > ls *.tar.gz | xargs -n 1 tar xzf >> >> >> 多谢您的好办法。真的想不通为何 tar 不能同时操作多个文件。 >> >> >> >> -- >> To UNSUBSCRIBE, email to [email protected] >> with a subject of "unsubscribe". Trouble? Contact >> [email protected] >> Archive: >> http://lists.debian.org/[email protected] >> >> > > > -- > Qin Li > -- Regards Tao Wang

