| Author |
store the output of "find" command in a variable?
|
shield kumar
Greenhorn
Joined: Feb 05, 2009
Posts: 28
|
|
|
how to store the output of "find" command in a variable inside a shell script?
|
 |
Andrew Monkhouse
author and jackaroo
Marshal Commander
Joined: Mar 28, 2003
Posts: 10816
|
|
Try:
The variable $FILES will now contain a list of all the files, directories, links ... in your home directory and sub-directories.
|
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14491
|
|
There's also an alternative notation that's common:
FILES=`find . name "*.pdf"`
Note that the delimiter for the command string is the "backtick" character, sometimes known as "left apostrophe". It's not the same thing as the normal (right) aprostrophe. On many keyboards, it's located to the left of the "1" key. In my case, it's on the same key as "~".
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Stefan Wagner
Ranch Hand
Joined: Jun 02, 2003
Posts: 1923
|
|
Tim Holloway wrote:Note that the delimiter for the command string is the "backtick" character, sometimes known as "left apostrophe". It's not the same thing as the normal (right) aprostrophe.
That's one reason why it's deprecated: confused by beginners.
The second reason is, is, it is hard to nest Commands with backticks, but easy with brackets.
|
http://home.arcor.de/hirnstrom/bewerbung
|
 |
 |
|
|
subject: store the output of "find" command in a variable?
|
|
|