shell variable expansion
Have you ever found yourself writing a shell script and wanting to incorporate the value of a variable into a command or string? Or maybe you've wanted to manipulate the value of a variable before using it in your script. If so, then you'll want to learn about shell variable expansion. Lets take a deep dive into this powerful feature of the shell and explore some of the various ways you can use it to make your scripts more flexible and efficient
Read or watch.
printenv
set
unset
export
alias
unalias
.
source
printf
By the end of this project, you should be able to explain to anyone Without the help of google the following concepts
- What happens when you type $
ls -l *.txt
- What are the
/etc/profile
file and the/etc/profile.d
directory - What is the
~/.bashrc
file
- What is the difference between a local and a global variable
- What is a reserved variable
- How to create, update and delete shell variables
- What are the roles of the following reserved variables:
HOME
,PATH
,PS1
- What are special parameters
- What is the special parameter
$??
- What is expansion and how to use them
- What is the difference between single and double quotes and how to use them properly
- How to do command substitution with
$()
and backticks
- How to perform arithmetic operations with the shell
- How to create an alias
- How to list aliases
- How to temporarily disable an alias
- How to execute commands from a file in the current shell
Read your /etc/profile
, /etc/inputrc
and ~/.bashrc
files.
Look at some files in the /etc/profile.d
directory.
Note: You do not have to learn about awk
, tar
, bzip2
, date
, scp
, ulimit
, umask
, or shell scripting, yet.