Librenix  
(Show all Scripting articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Command substitution in Bash scripting

Up
vote
Down

Command substitution is a useful way to take the output of one command and use it as an argument in another command.
The first way is the more modern way, and is really the only way that you want to use. You surround the command that you want to substitute with parentheses, and then precede it with a dollar-sign. Here, we’re using echo to show the output of date.

echo $(date)
 read more | score:6721 | -aweber, February 5, 2011
More Programming articles...

Beautiful Abstract Art Prints

coding headlines

No Starch Press has published my Perl One-Liners book!

OpenShift Online: a non-developer guide

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin