[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what is wrong here?

From: Francky Leyn
Subject: Re: what is wrong here?
Date: Wed, 28 Mar 2012 18:25:25 -0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0

On 8/8/2011 2:17 PM, mhenn wrote:
Am 08.08.2011 11:33, schrieb Francky Leyn:

consider the following code:


echo "$INPUT_FILES" #obviously wrong
#instead maybe

I tried something similar:


This worked when there were files.
But when there were no matching files, it didn't.
In that case the words of the ls error message were
considered as files, which is obviously wrong.

I'm new to bash, and have never seen a construct like yours.
Could you briefly explain what the dollar and the () mean (subshell)?

Btw: how can I get rid off the ls error message in your construct?
I tried already by postponing with >/dev/null, and 2>/dev/null, but
that all doesn't help. Is ls writting to /dev/tty? and in that case,
how can I suppress the ls error message?

Anyway, your construct works fine for files without spaces or newlines.
Now up to the link you have me.

Thanks for the help!

if [ -z "$INPUT_FILES" ]; then
   echo "No .$EXTENSION input files in this directory"
   exit -1


What is wrong here?

Best regards,

Francky Leyn

I think there are even better ways to do this, but this is one that came
to my mind at the moment.


man bash | less -p 'Pathname expansion'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]