Homework 3
This homework is worth 10 points.
Goals
When you finish this homework you should:
- Learn more about the bash shell.
- Understand the startup process for bash.
- Be able to set the prompt in bash.
Assignment
Read the bash man page.
Create a document which answers the following:
- List the files that are executed when bash is started as an interactive login shell. Are all of these files executed? Explain how you discovered the answer to the second part.
- Describe the files that are executed when a login shell exits.
- The program finger allows you to look up information about a user. This includes displaying the user's .project and .plan files. A user wants to have their .plan file say "I am here and logged in, come and see me." when they are logged in, or "I logged out on date." when they are not logged in. date should be replaced by the date the user logged out. How could this be accomplished? You might want to look at shell command substitution. You may assume that the user always employs a login shell.
- The shell is string based and parses using white space as a delimiter. In order to produce a string which includes white space, the string is surrounded by quotation marks.
Setting a shell variable is accomplished by var=value with no spaces.
Develop the bash command necessary to set the user's primary prompt to be username on terminal#: current directory $. For example, my prompt might be: dbennett on terminal 2: ~/311 $ . In this case the user name, the terminal number and the current directory should be replaced with the actual values.
- What does the shell command export accomplish?
Submit a hard copy of this document at the beginning of class on the due date.