Shell Script that outputs the number of users with entries in the /etc/passwd file

in Categories File-management last updated April 9, 2008

Shell script to read 5 digit number and calculate the sum of digit

in Categories Shell Math last updated April 4, 2008

Shell Script to display current date, calendar, and the number of user logged

in Categories Academic last updated April 3, 2008

This script use the concept of command substitution. It allows allows the output of a command to replace the command name. There are two forms:




Bash shell performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting.

For example you can execute date command to display todays date and then set a variable called NOW:
To display back variable value simply run echo command:
echo $NOW

Sample Shell Script