AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  ksh pattern wanted

    Posted Mon May 26, 2014 02:44 PM

    Originally posted by: JoachimB


    I'm looking for a pattern that would match any file or directory except '.' and '..'

    So e.g. it should return:

    test

    .test

    t

    test_test

    etc

    Any ideas? Thanks ...

    I want to use it on a chown -R command and want to avoid it to run into '.' and '..'.


    #AIX-Forum


  • 2.  Re: ksh pattern wanted

    Posted Tue May 27, 2014 09:34 AM

    Originally posted by: Wouter Liefting


    That would be * .[!.]*

    The first star matches all filenames that are not hidden. The second stanza matches all hidden files of two characters or more (including the leading dot), where the second character is not a dot.


    #AIX-Forum


  • 3.  Re: ksh pattern wanted

    Posted Tue May 27, 2014 11:44 AM

    Originally posted by: JoachimB


    Brilliant, thank you!

    Unfortunately I don't understand that two stanzas can be stringed together and that this is interpreted as "match a or b".

    Can't find any word about this in David G. Korn's "The new Kornshell" (my ksh bible).

     


    #AIX-Forum