-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/whatsapp
Copy pathMore file actions
executable file
·43 lines (32 loc) · 769 Bytes
/whatsapp
File metadata and controls
executable file
·43 lines (32 loc) · 769 Bytes
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
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
cc=55 # Default Country Code
ac=21 # Default Area Code
api='https://web.whatsapp.com'
apinum='/send?phone='
apimsg='&text='
num=${1:-}
msg=${2:-}
inputgui() {
prompt=${1:-'Número de Telefone'}
title=${2:-'WhatsApp Web Link'}
entry=${3:-}
local reply
if type -p zenity &>/dev/null && [[ "$TERM" == 'dumb' ]]; then
zenity --entry --width 250 --window-icon "${0}.png" --text "$prompt" --title "$title" --modal 2> >(grep -v 'GtkDialog' >&2) # --entry-text '5521'
else
read -p "${prompt}: " reply
echo "$reply"
fi
}
if [[ -z "$num" ]]; then
num=$(inputgui)
fi
[[ "$num" ]] || exit 1
case "${num:0:1}" in
+) num=${num:1};;
0) num=${cc}${num:1};;
*) num=${cc}${ac}${num};;
esac
url=${api}${apinum}${num}
echo "$url"
xdg-open "$url"