Linux Today: Linux News On Internet Time.

More on LinuxToday

HowTo: Use Bash Parameter Substitution Like A Pro

Oct 14, 2010, 22:03 (0 Talkback[s])
(Other stories by Vivek Gite)


Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame

[ Thanks to An Anonymous Reader for this link. ]

"The $ character is used for parameter expansion, and command substitution. You can use it for manipulating and/or expanding variables on demands without using external commands such as sed or awk.

#1: Getting Up Default Shell Variables Value

"The syntax is as follows:


"If parameter not set, use defaultValue. In this example, your shell script takes arguments supplied on the command line. You'd like to provide default value so that the most common value can be used without needing to type them every time. If variable $1 is not set or passed, use root as default value for u:


"Consider the following example:"

Complete Story

Related Stories: