Select Your Language

Infrastructure and Management

Cloud Computing

Storage

Runtimes

Integration and Automation

  • Comments
  • Wild Card in Script

    Posted on

    Hello. I am trying to run a Shell script and I get the following output to the console.

     ./georgetest.sh
    + file9='/u01/jde/interface/outbound/EXAMPLE_USD_ALL_OTHB_*.txt'
    + '[' -f '/u01/jde/interface/outbound/EXAMPLE_USD_ALL_OTHB_*.txt' ']'
    

    There are no error messages. I am wondering if it is beause of the Wild Card that is in the script. Here is my script.

    #!/bin/bash -x
    
    file9="/u01/jde/interface/outbound/EXAMPLE_USD_ALL_OTHB_*.txt"
    
    #
    if [ -f "$file9" ]
    then
            echo "Sending an attachment." | mutt -a $( printf -- '-a %q'/u01/jde/interface/outbound/EXAMPLE_USD_ALL_OTHB_*.txt) -s "Example USD All OTHB *" xxxx@drew-marine.com,xxxxx@drew-marine.com,xxxxxx@drew-marine.com,xxxxx@drew-marine.com,xxxxx@drew-marine.com,xxxxxx@drew-marine.com,
            echo $file9 " mailed at time below:" >> "/u01/jde/interface/outbound/example2-files.log"
            date >> "/u01/jde/interface/outbound/example2-files.log"
            rm -f /u01/jde/interface/outbound/backup/EXAMPLE_USD_ALL_OTHB_*.txt
            cp $file9 /u01/jde/interface/outbound/backup/
            rm -f $file9
    fi
    
    

    I tried enclosing "$( printf -- '-a %q'/u01/jde/interface/outbound/EXAMPLE_USD_ALL_OTHB_*.txt) -s" in double quotes but the result is the same. There is nothing in th elog file either.

    by

    points

    Responses

    Red Hat LinkedIn YouTube Facebook X, formerly Twitter

    Quick Links

    Help

    Site Info

    Related Sites

    © 2026 Red Hat