Note: I use tcsh.
I am trying make an alias that will use the mutt command to send an email with a pre-written body and subject line but that will take the alias argument and attach it to the email. The best I currently have is:
alias emailattach 'echo "Message Body" | mutt -a \!:1 -s "Subject" firstname.lastname@example.org'
This alias sets just fine, without any whining, but when I try to run it I get the following message:
Can't stat email@example.com: No such file or directory firstname.lastname@example.org: unable to attach file.
When I remove
I no longer get the error message, so I believe the problem could be focused on this portion of the alias. The files I've told
emailattach to attach are real, attachable files (a PDF specifically), so that's not the issue.
I also tried the same alias but without the single quotes and I only got this error:
email@example.com: unable to attach file.
To see if the pipeline was the crux of the problem I tried the following:
alias emailattach mutt -a \!:1 -s "Subject" firstname.lastname@example.org
and then tried just running:
echo "Message Body" | emailattach /path/to/attachment
which gave the same error message as I first listed(
unable to attach file.). However, when I just ran:
echo "Message Body" | emailattach
I got this error:
Bad ! arg selector.
Which I assume is just an error saying that I forgot to put in the required argument.
What have I written wrong in my alias that makes it not work?