wood burning stoves 2.0*
The moose likes Linux / UNIX and the fly likes store the output of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "store the output of "find" command in a variable?" Watch "store the output of "find" command in a variable?" New topic
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: 11404
    
  81

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: 15960
    
  19

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: store the output of "find" command in a variable?
 
Similar Threads
Arrays: Calling input from other methods and classes
error correction
not able to start jboss
how to list info of more than one jar.
Constants