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

Buy Large Wall Art Prints

coding headlines

OpenShift Online: a non-developer guide

Detailed Error Handling In Bash

Tutorial: Install SVN, Configure multi-protocol access (Ubuntu 11.10)

E-book: Perl One-Liners Explained

bash scripting: Looping through a list

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

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

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