LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 818|回复: 2

《Bash Guide for Beginners》(Bash新手指南》 第一章练习的问题

[复制链接]
发表于 2007-7-31 14:43:16 | 显示全部楼层 |阅读模式
接触Linux也蛮长时间了,但是一直没有系统学习过BASH,这个暑假想系统学习一下BASH,我看的教材是《Bash Guide for Beginners》(bash 新手指南) ,我是主要看原版,偶尔对照中文版的看。今天看完第一章,然后做了一下书后的习题。现在想让诸位检查一下我做的答案是否有误。

说明:  下面的“A”表示我的回答

1. Where is the bash program located on your system?

A:$  which bash

2. Use the −−version option to find out which version you are running.

A:  $ bash  --version

3. Which shell configuration files are read when you login to your system using the graphical user  interface and then opening a terminal window?

A:  ~/.bashrc      ~/.bash_profile    /etc/profile


4. Are the following shells interactive shells? Are they login shells?
            ♦ A shell opened by clicking on the background of your graphical desktop, selecting             "Terminal"
               or such from a menu.
            ♦ A shell that you get after issuing the command ssh localhost.
            ♦ A shell that you get when logging in to the console in text mode.
            ♦ A shell obtained by the command xterm &.
Chapter 1. Bash and Bash scripts                                                                       19
                           Bash Guide for Beginners
♦ A shell opened by the mysystem.sh script.
♦ A shell that you get on a remote host, for which you didn't have to give the login and/or
  password because you use SSH and maybe SSH keys.

A: 我至今没有搞明白什么叫做interactive shells ,如何判断,书中对此的解释我没有看懂,而且我Google了一下,似乎很难找到相关内容,谁帮我解释一下


5. Can you explain why bash does not exit when you type Ctrl+C on the command line?

A: 我猜可能BASH的代码里面有一个signal函数,用来Ctrl+C的信号

6. Display directory stack content.

A:  $ dirs    #这个是我Google 来的,不过似乎打印不出什么阿?


8. Display hashed commands for your current shell session.

A: $ hash

9. How many processes are currently running on your system? Use ps and wc, the first line of output of  ps is not a process!

A :    $ps  aux |   wc -l


10. How to display the system hostname? Only the name, nothing more!

A:    $hostname
发表于 2007-7-31 16:05:55 | 显示全部楼层
你打字,按回车,得结果,此乃interactive shell
shell script执行的环境,乃non-interactive shell
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-7-31 16:21:44 | 显示全部楼层
明白了,interactive这个词有些迷惑性。我一直在想是不是在执行过程中不能接受用户输入的称为non-interactive shell,反之则是interactive shell.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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