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:8220 | -aweber, February 5, 2011
More Programming articles...

Buy Art Online with a Money-Back Guarantee

coding headlines

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

Using Git for Source Control

Bash: Use the Test Command for multiple aspects

Add Video Streaming to C/C++ apps with Nex Gen Media Server API

String matching in regular expressions

Create native looking Firefox web apps

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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