Shell wild card characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nano2
    New Member
    • Jan 2007
    • 41

    #1

    Shell wild card characters

    Hi,
    Does anyone know how i could use wild chars like so:
    echo "-->This is ${MY_HOME}/config/log/test{*}.pid";

    The file will start like so with
    test123.pid
    test12421.pid
    testrqwrqwr.pid
    test435ytft.pid
    Does anyone know how i could achive this ????
  • arne
    Recognized Expert Contributor
    • Oct 2006
    • 315

    #2
    Originally posted by nano2
    Hi,
    Does anyone know how i could use wild chars like so:
    echo "-->This is ${MY_HOME}/config/log/test{*}.pid";

    The file will start like so with
    test123.pid
    test12421.pid
    testrqwrqwr.pid
    test435ytft.pid
    Does anyone know how i could achive this ????
    What about something like
    Code:
    #!/usr/bin/sh
    
    list=`ls test*.c`
    echo $list
    HTH,
    arne

    Comment

    • shahjapan
      New Member
      • Apr 2007
      • 63

      #3
      Originally posted by arne
      What about something like
      Code:
      #!/usr/bin/sh
      
      list=`ls test*.c`
      echo $list
      HTH,
      arne
      --------------------------------------------------------------
      Hi arne,

      I have 1 more Idea

      you can do 1 more thing
      Code:
      for each_file in `ls test*.c`
      do
      		echo $each_file
      done

      Comment

      • Motoma
        Recognized Expert Specialist
        • Jan 2007
        • 3236

        #4
        echo "-->This is $HOME/config/log/test{*}.pid" && ls $HOME/config/log/test*.pid

        Comment

        Working...