Test pattern file name - Aix

This is a discussion on Test pattern file name - Aix ; Hi, In a script shell how can I test if a file is like *.ext ? Thanks in advance...

+ Reply to Thread
Results 1 to 3 of 3

Thread: Test pattern file name

  1. Test pattern file name

    Hi,

    In a script shell
    how can I test if a file is
    like *.ext ?

    Thanks in advance



  2. Re: Test pattern file name


    astalavista wrote:
    > Hi,
    >
    > In a script shell
    > how can I test if a file is
    > like *.ext ?
    >
    > Thanks in advance


    This will work .. check out the "test" command for the different flags

    if [ -f *.ext ]
    then
    echo yay
    else
    echo nay
    fi

    HTH
    Mark Taylor


  3. Re: Test pattern file name


    > This will work .. check out the "test" command for the different flags
    >
    > if [ -f *.ext ]
    > then
    > echo yay
    > else
    > echo nay
    > fi


    Sorry for my bad explanation,
    in a script I need to test if $1 is in the form *.ext.

    How I can do it ?

    Thanks in advance



+ Reply to Thread