getting FNM_PATHNAME behaviour from pattern matching

2009-02-07 Thread Sitaram Chamarty
Hello,

I'm trying to match a patterm that requires the behaviour of
FNM_PATHNAME (from fnmatch(3)).  Unlike, say, FNM_PERIOD,
which is emulated by unsetting 'dotglob', there does not
seem to be an equivalent to emulate FNM_PATHNAME.

I'd like
[[ abc/dd/def.html == abc/*.html ]]; echo $?

to return 1, not 0.

What am I missing/doing wrong?





A Suggestion On Bash

2009-02-07 Thread donglongchao
Dear Sir or Madam:   
   I have a wonderful idea about Bash(GNU bash version 3.2.39(1)-release 
(i486-pc-linux-gnu)).   

    When I use tools like 'cat' or some other commands like this,I find it 
hard to specify where the file that I 'cat' begins because the command I typed 
just now was mixed with the file I want to read and they look like the same.  

    So I think if we could add special color such as red or green to the 
command lines we typed before to mark them,just like the different colors on 
different kinds of files and catalogues,it will be much easier for us to tell 
where the file we want to read begins. 

    I am looking forward to your replay.  
    Wish you 
happy!  
   Yours    
    
   
donglongchao    
    

    2009.2.7


Re: A Suggestion On Bash

2009-02-07 Thread Sitaram Chamarty
On 2009-02-08, donglongchao  wrote:
> Dear Sir or Madam:    I have a wonderful idea about
> Bash(GNU bash version 3.2.39(1)-release
> (i486-pc-linux-gnu)).   
>
> When I use tools like 'cat' or some other commands
>like this,I find it hard to specify where the file

you probably mean 'identify' not 'specify'

>that I 'cat' begins because the command I typed
>just now was mixed with the file I want to read and
>they look like the same.  
>
> So I think if we could add special color such as
>red or green to the command lines we typed before
>to mark them,just like the different colors on
>different kinds of files and catalogues,it will be
>much easier for us to tell where the file we want
>to read begins. 

'man bash' and read about PS1 (the primary bash prompt).
There are hundreds of ways to color output, used for all
sorts of things; a very recent example from my life is at
http://sitaramc.github.com/images/git-completion-plus.png --
every command line in that screenshot is colored in some
way.

As an example, the PS1 I use is:

PS1='\[\e[32m\]\t\[\e30m\] \h:\W \$ \[\e[m\]'





Re: Declaring variables as local effects command status $?

2009-02-07 Thread Michael Rendell
Hi,

On Friday 06 February 2009 17:02, Paul Jarc wrote:
> Michael Rendell  wrote:
> > local x=$( echo hi; exit 20);
> > ret=$?
>
> Here you're getting the exit status of "local" itself, which is 0.  If
> you want the exit status of the command substitution, make that a
> separate command:
>   local x
>   x=$( echo hi; exit 20);

Yes - realized that might be the case after sending the message; similar for
the export command.  Sorry!

Best wishes,
Michael