LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] quick bash loop?

[ILUG] quick bash loop?

Niall O Broin niall.obroin at gmail.com
Tue May 22 16:30:51 IST 2012


On 22 May 2012, at 16:15, Bernhard Rohrer wrote:

> may I ask for help with bash again please? I have a .jar that when told to work on * only works on the first file in the directory. Can anybody suggest a simple way to make it munch through the whole directory?

When you issue a command line such as 

WHATEVER *

the executable WHATEVER is searched for along the path, and then called with whatever * expands to in the current directory (and current bash versions may pass a literal * to the app. if no match is found).

If your jar only process the first file, this means that it doesn't have internal logic to process more than one command line argument (though it could conceivably do its own wild card expansion - what happens if you pass it '*'  ?)

Presuming that this doesn't work, the way to handle it with bash is 

for arg in *; do WHATEVER $arg;done



Niall



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell