Akshay Hazari Akshay Hazari - 2 months ago 18
Bash Question

Using pee command with quotes in command

I have the following shell command which I need to use for sending output of code to two parallel commands.

cat /data/market_voices_spam_classifier/v5/logs/server.log | sh mapper.sh | python2.7 reducer.py | pee 'tee spammers-`date -d "-1 days" +%Y-%m-%d`' 'EMAIL=noreply mutt -s Test_Mail mail_id@gmail.com'


While it works perfect just a small problem is that I wish to change the mail subject here from
Test_Mail
to
'Test Mail'
for which I need to use quotes in the pee command and then it doesn't work as it should not.

Answer

It was a bit trivial issue. I just added the double quotes outside and used the single ones in it.

cat /data/market_voices_spam_classifier/v5/logs/server.log | sh mapper.sh | python2.7 reducer.py | pee 'tee spammers-`date -d "-1 days" +%Y-%m-%d`' "EMAIL=noreply mutt -s 'Test Mail' mail_id@gmail.com"

I know I am no good at shell. Please spare me.

Comments