Install the script ( e.g attach.sh )
#! /bin/bash
#
# Script created by ASID
# Modified by sura
# Attach files to thunderbird
temp=""
count=0
mydir=`pwd`
for i in $*
do
count=$(( $count + 1 ))
if [ $count -eq $# ]
then
temp=${temp}file://${mydir}/${i}
else
temp=${temp}file://${mydir}/${i},
fi
done
echo $temp
if thunderbird -remote "ping()" 2> /dev/null ;
then
thunderbird -remote "xfeDoCommand(composeMessage,attachment='$temp')"
else
thunderbird --compose "attachment='$temp'"
fi
Then just issue the command
bash attachs.sh filenames
Friday, June 8, 2007
Subscribe to:
Post Comments (Atom)
2 comments:
The proposed solution seems to be too verbose, and it does not work if attached files are not in the current directory. That's what I use:
FILES=$(for FILE in "$@"; do
echo "file://$(readlink -f $FILE)"
done | xargs | sed "s/ /,/g")
exec thunderbird -compose "attachment='$FILES'"
@tokland: Nice, but it will not work when the attached filenames or their respective pathnames contain spaces. The adapted script below does.
#!/bin/sh
FILES=$(for FILE in "$@"; do
echo "file://"$(readlink -f "$FILE")""
done | xargs | sed "s/ file:\/\//,file:\/\//g")
exec thunderbird -compose "attachment='$FILES'"
Post a Comment