bash - printing parameters

A parameter is an entity that stores value and is available to a program. There are many system variables available to BASH. They could be retrieved easily by prefixing a $ sign to the variable. Alternately, you can also surround them with curly braces and prefix a $ sign

#!/bin/bash
#: Title       : print parameters
#: Version     : 1.0
#: Description : print parameters
#: Options     : None

printf "%s " "Current Working Directory"
echo $PWD
printf "%s " "Home Directory"
echo ${HOME}
printf "%s" "Command Directories $PATH"

Output of the script

Current Working Directory /home/me/sandbox
Home Directory /home/me
Command Directories  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • PWD prints the current working directory of the shell
  • HOME store the address of the user's home directory
  • PATH returns a colon-separated list of directories where command files are stored
Technologies: