Go to your home directory and edit .bash_profile to define the global variable chris
whose value is the absolute pathname of my home directory.
Again in .bash_profile define an alias ck which will take you to my home directory using the variable defined above.
Also in .bash_profile define a function go_show, that will
Go to a specific directory
Print your current location
Print the contents of your current directory
The directory this function takes you to will be specified as an argument to the function on the command line.
You will need to use a positional parameter to do this.
Steps for Script
Print to the terminal the value of the variable chris.
Using a pipeline, grep and a command that will show all your global variables, print to the
screen the full definition of the variable chris. Do not use echo
to do this. The command to show all global variables was mentioned in the first class were global variables
were discussed.
Aliases and functions are not global, so they cannot normally be run inside a shell script.
Go to your home directory
Run a command that will run the startup file where you defined the alias ck
and the function go_show inside your current shell
Run a command that will show me all the aliases currently defined
Use the function go_show to move to my home directory using the global
variable chris.
Run a command that will show all the aliases you have currently defined.
Run a command that will show the last 20 commands in your history list.
Using a single echo command print to the terminal a single string enclosed in quotes, and the variable chris.
The string should print the following message:
The home directory of my instructor is /home/ckelly