LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
楼主: jessew

GNU 1.0

[复制链接]
发表于 2003-12-14 23:58:29 | 显示全部楼层

辛苦了,兄弟,顶一下,表示支持!

辛苦了,兄弟!顶一下,表示支持!
发表于 2003-12-15 09:32:51 | 显示全部楼层
Introduction to Scripting with Bash
===================================
介绍Bash的脚本编程
   These next few paragraphs are to aquaint the user of GNU/Hurd with extended shell capabilities. The bash shell is a very powerful program.  You may have seen the term "Shell Programming", well that is what Bash can be used for. The shell can be used to write scripts to automate a handful of commands into one file. The start of a typical shell script will look like this:
  下面的几段使GNU/Hurd的用户熟悉扩展的shell性能.bash shell是一个功能十分强大的程序.你可能已经看到术语”Shell 编程”,这就是Bash可以用来做的事情.shell可以用来写脚本以自动的把一连串命令写到一个文件里面.典型的脚本的开头看起来像这样:
     #!/bin/bash
     # The above line has to be the very first line of your
     # script. If it's not it is taken as a comment.
     #
     # This is a comment
     uname -a ; df /
     
     echo This is a shell script
     uptime &&
     
     cat /etc/fstab

   The very first line is a interesting one. The `#!/bin/bash' is to notify the shell of what program to use to run the script.  The next two lines are comments, the '#' character is used to allow us to type important information that the script won't execute.  Finally we get to the command `uname -a' which will tell us the operating system we are using, with the -a option it tells us everything we need. Following the first command is the ';' character which tells bash there is a compound command. The semicolon will tell bash to execute the command on the left first, then the right.  The '&&' symbols after "uptime" in the above script tell bash not to execute the next command until the uptime command is complete. The difference between the ";" and the "&&" is the first character will spit out a error and then continue to the next command.  In order to execute the above script the file attributes need to be changed to an executable format. To change file attributes you use `chmod 755'.  The `chmod' command is pretty tricky, so read the info and/or man pages to fully understand the capabilities of `chmod'.
  第一行正好是有意思的一行.`#!/bin/bash'通知shell用什么程序来运行脚本.下面的两行是注释,'#'字符用来允许我们输入脚本并不执行的重要的信息.最后到了告诉我们我们正在运行的操作系统的信息的命令'uname -a',通过-a选项它告诉我们我们所需要的每一件事.跟着第一个命令的是';'字符,它告诉bash shell有组合的命令.分号会告诉bash先执行在左边的命令,然后是在右边的.上面脚本中位于”uptime”之后的'&&'符号告诉bash不要执行下一条命令,直到uptime命令完成了.”;”和”&&”之间的不同在于第一个字符”;”会弹出一个错误然后接着执行下一条命令.要执行上面的脚本,文件属性必须设为可执行格式.使用'chmod755'来改变文件属性.'chmod'命令是十分机巧的,所以读一下info和/或者man页来完全弄懂'chmod'的性能.
   Bash has other time saving features, for instance the `export'. You can export a couple of letters to represent a full path to a directory. The export command is typically used for this, here is a example:
   Bash有别的节省时间的特性,例如'export'.你可以输出三两个字母来代表一个目录的完整路径.export命令典型的这样使用,这是一个例子:
     bash-2.05$export SRC=/home/src
     bash-2.05#echo $SRC
      /home/src

   In the above example we use the `echo' to tell us what the value of 'SRC' is. Without the '$' character the `echo' would just print out 'SRC'.  The `echo' is used extensively in shell scripts to place text on our screen either for debugging purposes or to prompt the user for input.
   在上面的例子中我们使用'echo'告诉我们'SRC'的值是什么.没有'$'字符,'echo'会只是输出'SRC'.'echo'广泛用在脚本里把文本放到我们的屏幕上以便调试或者提示用户输入.
   The great thing about shell scripts is that they have the capability of doing things just as quickly as a compiled program.  A compiled program is written, compiled, and then run.  The benefit of using a script is it is written then interpeted (interpreted)by the shell.  When scripts get too large or complicated they are sometimes re-written in a compiled language. The reasoning behind this is that the shell script can slow the machine down the larger it gets, and take away resources that could be better used elsewhere on the computer.  To get a better understanding of "Shell Programming" there are numerous books and on-line documents to be used.
  关于shell脚本最有意义的是他们有能力像编译了的程序一样快的做事情.一个编译了的程序得写出来,编译,然后才执行.使用一个脚本的好处在于它被写了以后由shell解释.当脚本变得太大或者过于复杂时它们有时会用一个编译式语言来重写.在这背后的原因是shell脚本越大它就使得机器越慢,而且占据可以在计算机的别的地方更好的利用的资源.要更好的理解”Shell 编程”,有数目众多的书籍和在线文档可以用.
   Your GNU/Hurd workstations is comprised of many shell scripts.  For instance when you login to the shell a couple scripts set up your enviroment for you.  The scripts .profile and .bashrc set things such as
   你的GNU/Hurd工作站包含许多的shell脚本.譬如,当你登陆到shell时一大堆的脚本为你设置你的环境.脚本.profile和.bashrc设置像这样的东西:
  1. PATH : This is typically":/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin"  and can
     be modified to suit your needs. Generally you programs
     will reside in "bin" or "sbin" directories. Instead of typing
        /usr/bin/gcc you can just type gcc and the computer knows
     where        it is.
   1.PATH:这是典型的:":/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6/bin" ,可以被修改来适合你的需要.通常你的程序会存在"bin"或"sbin"目录里.你可以只需输入gcc而不是/usr/bin/gcc,计算机也可以知道它在哪里.
  2. PS1 :  This is a bash variable that sets the look of your prompt.
           When the PS1 variable is not set you just see bash-2.05$
     as        your prompt.
  2PS1:这是设置你的提示符外观的bash值.当不设PS1值时你会只是见到bash-2.05$作为你的提示符.
  3. MANPATH:  The MANPATH variable is used so that when man is
     evoked                   It knows where all the man pages live.
  3 MANPATH:MANPATH值用来使当man被调用时它知道man页在哪里.
  4. alias : The alias command is used you disguise a command with
     anything         your heart desires except another command. A
     user can alias         the 'ls -a' to 'l' so at a bash prompt typing 'l
     <ENTER>'         will evoke 'ls -a'
  4 alias: alias命令假设你心里想要的除另外一个命令之外的任何词是一个命令的别名.用户可以把'ls -a'用别名表示成  'l',这样在bash提示符里输入'l<ENTER>'将会调用'ls -a'.
   As you get more comfortable with you GNU/Hurd workstation you will end up customizing some of these values to suit your needs.
   一旦你对你的GNU/Hurd工作站感觉更加轻松.你会结束定制这些值中的一些以适合你的需要
发表于 2003-12-15 09:41:14 | 显示全部楼层
谁用了K5的,觉得怎么样,和K4的有什么改善吗?我翻译的文档是K4的,所以可能有些地方不一样的话,请告诉我一声,如果可以的话,最好把图形界面装上,打个截图,因为hurd也快接近1.0版本了,图形界面对于hurd在L4内核前的普及是十分重要的,如果没有这个的话,很难说hurd还有什么优势,第一代微内核,特别是mach对于现在的应用,有些力不从心了.

我现在剩余空间只有300m左右了,240G的硬盘,因为装了很多东西,下了很多书籍,分了很多区.现在320G的硬盘得多少钱?
发表于 2003-12-15 17:18:08 | 显示全部楼层
File Archivers and Compression
==============================
文件档案和压缩
   In this section, I want you to learn some extra things that will make life interesting.  You will need to learn about archives. Archives come in many different formats.  Archive is a general term for a software package.  You may have heard of a "tarball": this is a form of archive.  The file extensions tell us what type of archive the file is.  Generally they come in forms of .tgz, .tar.gz, .tar.bz2, .gz, etc.
  在这一节里,我想你学一些使得生活有趣一点的额外的事情.你会需要学习档案打包.档案来自于许多不同的格式.归档是软件包的一个惯用术语.你或许听过”tarball”:这是一种归档档案.文件扩展名告诉我们归档包裹文件是哪一种格式的.一般他们以 .tgz, .tar.gz, .tar.bz2, .gz等等形式存在.
   "Archiving" is a method of packaging files.  It has been around since the early days of computing.  The `tar' command that we use when working with archives stands for "tape archiver". It was originally used to create archived files for backup on large tape drives.
   “归档”是包装文件的的一种方法.它从计算机的早期历史开始就存在.我们对归档包裹文件使用的'tar'命令代表”磁带归档”它一开始是使用来在大的磁带驱动器上创建文件的.
   Closely associated with archiving is the concept of "compressing". Various algorithms can be used to pack data into a smaller format. Archives are often compressed before being distributed; for example, a tarball may have the extension `.tar.gz', which means that the tarball is a `tar' archive that has been compressed using `gzip'. Most software that you try and install from source-code will be packaged this way.  I will try to give you some examples; if you're confused, always consult the info pages.
  紧紧和归档相关联的是概念”压缩”.各种各样的算法可以用来压缩数据成更小的格式.归档文件经常在分发之前先压缩;例如,一个tarball也许有扩展名'.tar.gz',意思是这个tarball是一个已经用'gzip'压缩过的'tar'包.大多数从源码安装的软件会以这个方式打包.我会给你一些例子;如果你觉得迷惑,常常查阅info页.
   Let's say we get a `tar' file that has some documents you want to read.  Make sure that you are in your home directory, then type:
   让我们假设我们得到了一个包含一些你想阅读的文档的'tar'包.确信你在你的home目录下,然后输入:
     bash-2.05$ tar xv docs.tar <ENTER>

   After running this command, you would see the contents of the tar file extracted to your home directory.  The `x' stands for "extract" and the `v' means "verbose", which shows us the contents of the archive as it's being decompressed.  Compressing a file or directory is very similar.  You would use type:
    执行这个命令后,你会看到tar文件的内容被解压到你的home目录.'x'代表”extract解压”而'v'意思是”verbose详述”,显示归档文件的内容好像它被解压了一样.压缩一个文件或者目录是很类似的.你会输入:
     bash-2.05$ tar -cv new.tar foo1/ foo2/ <ENTER>

   The `-c' is to create the tar file.  We add the name of the tar file, then the contents that we want.  In the above example, we created a file called `new.tar' and we added the directories `foo1/' and `foo2/' to the tar file.  With the `-v' option we see what is being added.
   '-c'是创建tar文件.我们加了tar文件的名字,然后是我们想加进去的内容.在上面的例子中,我们创建了一个叫做'new.tar'的文件并且增加了'foo1'和'foo2'文件到这个tar文件里.通过'-v'选项我们看到了什么文件正在加进去.
   The `gzip' compression format is commonly used in the GNU system. Files with the extionsion `.gz' are associated with `gzip'.  The utilities `tar' and `gzip' work so well together that people have patched the tar command so that it can compress and decompress `gzip'ed files.  Note, however, that `tar' cannot be used to decompress `gzip'ed files that are not `tar' archives.
   'gzip'压缩格式在GNU系统中常用.带扩展名'.gz'的文件和'gzip'关联.'tar'和'gzip'实用程序在一起工作的如此之好所以人们给tar命令打了补丁这样它可以压缩和解压'gzip'过的文件.注意,然而,'tar'无法用来解压'gzip'压缩过的不是'tar'归档的文件.
     bash-2.05$ tar -zxv file.tar.gz <ENTER> #This file was compressed once with tar then with gzip
     bash-2.05$ gzip -d file.gz <ENTER>     #notice no tar in filename means you
     use
                                              gzip

   In the first example, the `z' after the `tar' command is the option that tells `tar' that the file has been `gzip'ed.  The second example is the `gzip' command, using the `d' option to decompress `file.gz'. `gunzip' is a command that is equivalent to `gzip -d', but more intuitive.
   在第一个例子里,跟在'tar'命令后的'z'是一个告诉'tar'文件是被'gzip'过的.第二个例子是'gzip'命令,使用'd'选项解压'file.gz'.'gunzip'是一个等效于'gzip -d'的命令,但是更直观点.
     bash-2.05$ gunzip file.gz <ENTER>

   To compress a `tar' files, or any file, using `gzip',  you would type:
   要使用'gzip'压缩一个'tar'文件,或者任何文件,你会输入:
     bash-2.05$ gzip -9 file.tar <ENTER>

   The `-9' means best compression.  There are many options available for `gzip'.  A quick browse through the info pages will tell you everything you need to know.
   '-9'意味着最高的压缩率.'gzip'还有许多可用选项.一个穿越info页的快速浏览会告诉你你需要知道的任何事.
   Another common form of compression is the `bzip2' format. `tar' archives compressed using `bzip2' usually have the extension `.tar.bz2'.  This format is known to be one of the best compression utilities.  To extract a bzip2 file you would type:
    另外一种通用的压缩形式是'bzip2'格式.使用'bzip2'来压缩的'tar'包经常用扩展名'.tar.bz2'.这种更是是已知的可用程序里最好的一种之一.要解压缩一个bzip2文件你会输入:
     bash-2.05$ bunzip2 file.bz2 <ENTER>

   Like the `gzip' format, the `bzip2' format has many options.  You will probably see `bzip2' compressing `tar' files.  The `bzip2' utility many other commands linked to it.  To extract a file that has been archived with `tar' and compressed with `bzip2', you would do something similar to the following:
    像'gzip'格式一样,'bzip2'格式有许多选项.你大概看见过bzip2压缩的'tar'文件.'bzip2'和许多别的命令联系在一起有许多可用用途.要解压一个用'tar'打包和'bzip2'压缩了的文件,你只需要做一些类似于下面的操作:
     bash-2.05$ bzcat file.tar.bz2 |tar -xv <ENTER>

   The `bzcat' command is a combination of `bunzip2' and `cat'.  We `bzcat' the file, then pipe(|) the file to the `tar' command.  Once again, I use `-x' to extract the file, and `-v' to see its contents. To compress a file using `bzip2' you would type:
   'bzcat'命令是'bunzip2'和'cat'命令的组合.我们'bzcat'文件,然后用管道(|)传给'tar'命令.我再一次使用'-x'解压文件,'-v'查看内容.要用'bzip2'压缩文件你会输入:
     bash-2.05$ bzip2 -z file1.txt <ENTER>

   This command compresses `file1.txt' to `file1.txt.bz2'.  You can also use the `'-9'' option for best compression.
    这个命令压缩'file1.txt'到'file2.txt,bz2'.你也可以使用'-9'选项得到最好的压缩率.
   Hopefully, this little chapter has gotten you more interested in using GNU/Hurd.  If you are still confused, please read the info pages for the command that's giving you trouble.  The command `info' will give you a list of all the programs on your Hurd machine that have documentation with them.  The best way to learn GNU utilities is to read and practice.  GNU/Hurd is just like music or sports: you can never learn enough.  This chapter is meant to give you a stepping stone to freedom.
  但愿,这一章已经使得你对使用GNU/Hurd更感兴趣.如果你依然迷惑,请阅读info页查找给你带来麻烦的命令.命令'info'会给你一个在你的Hurd机器上携带着文档的所有程序的列表.学习GNU实用程序的最好方式是阅读和实践.GNU/HUrd就象音乐或者运动:你永远学不够.这一章的意味是给你自由的进一步的铺路石.
发表于 2003-12-16 13:53:07 | 显示全部楼层
Administration
==============
管理
   After the last chapter, you're probably wondering about this "root user" that everyone is so fond of.  The Hurd is trying to get all things root out of the picture and allow you the freedom of doing things only root can do on legacy Unix systems.  The designers and developers want you, the user, to be able to do things that you cannot do on a traditional Unix-like operating system.
   上一章以后,你很可能想知道每一个人都如此喜欢的这个”根用户”.Hurd尝试着清除画面中所有一切并且允许你获得做传统Unix系统中仅仅root用户可以做的事情的自由.设计人员和开发人员想让你,用户能够做在传统的Unix类操作系统中不能做的事.
   For the time being, though, you will have to deal with the root user.
   然而,目前,你还需要处理根用户.
   One reasonable request of the Unix-type gurus is making a normal user account.  A normal user can only write to his or her home directory, and has limited access to system configuration.  The reasoning behind this is that a normal user can not mess up the computer.  This is a decent compromise because the more we explore and play, the more likely we'll lose a important file or make some other fatal mistake.  So what we'll do is set up a user account for you. You must be root to do this.
   Unix类型的专家的一个合理的要求是创建一个普通用户帐号.一个普通用户仅仅可以在他或者她的home目录写操作,而且被限制了系统配置的访问.在这背后的原因就是,这样,一个普通用户无法把计算机弄的一团糟.这是一个合理的折衷方案,因为我们探索越深入,玩的越投入,我们丢失一个重要文件或者做出一些别的致命错误的可能性就越大.所以我们要做的事情就是创建给你一个用户帐号.你必须是根用户来做这件事.
     bash-2.05# adduser <ENTER>

   That's it!  The computer will prompt you for a username and password, then you can just answer yes or whatever you require to the rest of the requests.  To change the password on your account you just created you would type:
   就是这样!计算机会提示你输入用户名和密码,然后你可以仅仅回答这些或者回答剩下的所有要求你回答的项目.要改变你刚刚创建的帐号的密码你可以输入:
     bash-2.05# passwd <USER_NAME> <ENTER>
     Please Enter a Password:

   There is a command that helps you become root while logged in as a normal user.  This command is called `su'.  When you type `su', you are required to enter a password (if you have one) for the root account. If a `ssh' (Secure Shell) server doesn't allow root logins, as root you can `su' to a another user that has an access to that server.  When you are done being another user you type `exit' and your back as root.
   当你登陆为一个普通用户时有一个命令可以帮助你变成根用户.这个命令叫做'su'.当你输入'su'时,会要求你输入密码(如果你有密码的话)来获得根用户帐号权限.如果'ssh'(Secure Shell安全Shell)服务器不允许根用户登陆,作为根用户你可以'su'成对那台服务器有存取权限的另一个用户.当你变成另一个用户时你输入'exit'会变回根用户.
     bash-2.05$ su <ENTER>
     password:

   There are many commands related to the Administering Unix-like operating systems.  As a normal user, much is unneeded.  Making a new user and giving him/her a password is enough for now.  If you are interested in becoming a Administrator there are plenty of books and classes out there.
   还有很多命令和管理Unix类操作系统有关.作为一个普通用户,很多是不需要的.现在创建一个用户并且给他/她一个密码就足够了.如果你对成为一个管理员感兴趣的话,有足够多的书籍和类在那里.
发表于 2003-12-16 14:17:04 | 显示全部楼层
Accessing the cdrom
===================
存取cdrom
   Traditionally, Unix-like systems have used a command called `mount' to merge removable storage devices, such as CDs and floppy disks, into the file system. On GNU/Hurd, we don't `mount' anything.  The Hurd has a similar mechanism for accessing devices called "setting a translator".
   按照惯例,Unix类系统使用一个叫做'mount'的命令合并可移除存储设备,像CD和软盘到文件系统中.在GNU/Hurd中,我们不'mount'任何东西.Hurd有一个类似的机理存取设备,叫做”设置translator”.
   We use the `settrans' command to do this.  `settrans' is a program that aligns a type of Hurd server called a "translator" to a device supported by the kernel.  For instance, on my GNU/Hurd system my cdrom device was detected as hd2.  To get to my data on a iso9660 CD, I first had to make the device.  Then I had to run the `settrans' command.  This had to be done as the root user (root is the only user that has these privileges).
  我们使用'settrans'命令来做这件事.'settrans'是对应一种叫做”translator”的内核设备支持服务的一个程序.举个例子,在我的GNU/Hurd系统里我的cdrom设备被探测为hd2.要取得我在一个ISO9660 Cd上的数据,我首先得创建这个设备,然后我必须运行'settrans'命令.这些必须作为根用户来做(根用户是唯一有这些特权的用户).
   The term iso9660 is a standard set by the Industry Standards Organization.The ISO has set the universal access to CDROM media as standard number 9660. Some systems use an extension to this standard called Joliet.  The Joliet extension is typical of Microsoft Windows. It is also supported on GNU/Hurd, GNU/Linux, and the BSDs.
   专有名词iso9660是一个由工业标准化组织制定的一个标准.ISO设置了通用的访问CDROM媒体的的标准即是标准号9660.一些系统使用对这个标准的一个扩展叫做Joliet.Joliet扩展的典型是Microsoft Windows.在GNU/Hurd,GNU/Linux和BSDs里也获得支持.
     bash-2.05# cd /dev <ENTER>
     bash-2.05# ./MAKEDEV hd2 <ENTER>
     bash-2.05# settrans -ac /cdrom /hurd/isofs /dev/hd2 <ENTER>

   This isn't too hard, is it?  Those options after `settrans' are very important.  The `-a' makes the `/hurd/isofs' translator active. The `-c' creates the translator, and is only needed the first time.
  这不太难,不是吗?'settrans'后的那些选项非常重要.'-a'激活'/hurd/isofs'translator.'-c'创建了translator,而且仅仅是第一次需要这样做.
  Now you can type `cd /cdrom' and see the data on your CD.
  现在你可以输入'cd /cdrom',看到你的CD上的数据.
 楼主| 发表于 2003-12-20 12:16:25 | 显示全部楼层
tianshan851兄,可否与我联系一下?
 楼主| 发表于 2003-12-23 10:04:19 | 显示全部楼层
At this time, I would like to send my warmest wishes of Merry Christmas and a Happy New Year to all of GNU/HURD fans and contributors.

By the way, a big thank you for visiting Linuxsir.com and Happy Holidays, wherever you are! :thank
 楼主| 发表于 2003-12-30 17:16:50 | 显示全部楼层
庆祝本贴浏览量超过10000人次!
感谢朋友们的热情!
希望采用 L4 微内核的 GNU 系统早日诞生!
发表于 2004-1-1 13:14:36 | 显示全部楼层
今天第一次装(K5),就一个基本系统,是从slackware 9.1下装的。
我分给了它800M空间,不知道要是装了X后空间不够怎么办?
可以把他的/usr或别的文件放单独的区吗?
请问对于我们普通应用它有什么优势?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表