0

I need to extract an attachment that I receive every day via email, on a linux server.

I'm using ripMIME for this task and have a script like this:

theFile=$(ls -t * | head -n 1)
ripmime -i $theFile -d /home/myDirectory/

First line assigns the name of the newest file (email) to the variable "theFile" Second line should extract it's attachments to the /home/myDirectory/ path, however it doesn't extracts anything.

However, if I execute this line: (including the file name instead of the variable)

ripmime -i 1536138112.M623890P26484.myDomain.com,S\=1345977,W\=1363482:2,S -d /home/myDirectory/

...then the files are successfully extracted and copied to the specified directory.

I need to use a variable since I can't possibly know the name of the file, I just need to extract the files from the newest email using a script.

Also, I don't get any output when the instruction fails, so I'm in the dark here.

The ripMIME tool documentation can be found here

Any help will be appreciated.

Sergio
  • 658
  • 1
  • 9
  • 22

1 Answers1

0

When I included those lines inside a script file (.sh) and executed it, then everything worked like a charm. That didn't happen when I was trying to execute it directly from command line.

Sergio
  • 658
  • 1
  • 9
  • 22