blob: b59ebe5f9f48284ce8d6f8ad99b5bc8ca6dae3c2 (
plain) (
blame)
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
32
33
|
#!/bin/bash
#
# little convenience wrapper around the mega cli tools
#
usage() {
echo "usage: mega -u USER -p PASSWD COMMAND"
echo ""
exit 0
}
while getopts ":hu:p:" o; do
case $o in
u)
user=${OPTARG} ;;
p)
passwd=${OPTARG} ;;
h | *)
usage ;;
esac
done
shift $((OPTIND - 1))
[ -z "$1" ] || [ -z "$user" ] || [ -z "$passwd" ] && usage
if ! command -v ${1} &>/dev/null; then
echo "error: ${1} not installed." >&2
exit 1
else
cmd=$1
fi
shift
exec "mega${cmd}" -u "${user}" -p "${passwd}" $@
|