Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

10.4.1 The Stages of Word Expansion

When word expansion is applied to a sequence of words, it performs the following transformations in the order shown here:

  1. Tilde expansion: Replacement of `~foo' with the name of the home directory of `foo'.
  2. Next, three different transformations are applied in the same step, from left to right:
    • Variable substitution: Environment variables are substituted for references such as `$foo'.
    • Command substitution: Constructs such as ``cat foo`' and the equivalent `$(cat foo)' are replaced with the output from the inner command.
    • Arithmetic expansion: Constructs such as `$(($x-1))' are replaced with the result of the arithmetic computation.
  3. Field splitting: subdivision of the text into words.
  4. Wildcard expansion: The replacement of a construct such as `*.c' with a list of `.c' file names. Wildcard expansion applies to an entire word at a time, and replaces that word with 0 or more file names that are themselves words.
  5. Quote removal: The deletion of string-quotes, now that they have done their job by inhibiting the above transformations when appropriate.

For the details of these transformations, and how to write the constructs that use them, see The BASH Manual (to appear).


 
 
  Published under the terms of the GNU General Public License Design by Interspire