File: geary-attach

package info (click to toggle)
geary 46.0-13
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,092 kB
  • sloc: javascript: 972; ansic: 722; sql: 247; xml: 183; python: 30; makefile: 28; sh: 24
file content (31 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

# This is a wrapper script to attach several files to an email in Geary.
# Written by Viko Adi Rahmawan <vikoadi@gmail.com>
# License: 3-clause BSD

#TODO: define a Gettext domain

# Disable history substitution on "!" symbols so we can have them in strings
set +H

if [ -z "$1" ] || [ "$1" = '-h' ] || [ "$1" = '--help' ]; then
    echo $"Usage: $0 /path/to/file [/path/to/another/file...]
Relative paths are also supported."
    exit 1 # so that calling without parameters is counted as a failure
fi

#we don't do file checking as geary is clever enough
ARG="mailto:?attachment=$1" #add first file
shift
while [ -n "$1" ]; do
    ARG="$ARG&attachment=$1" #add more file if 
    shift
done

if [ -n "$ARG" ]; then
    # Finally execute geary
    geary "${ARG}"
else
    exit 1
fi