CLI Tips
Introduction
Section titled “Introduction”This page contains some tips and helpful information when working with the Apprise Command Line Interface (CLI).
Scripting Multi-Line Input/Output with CLI
Section titled “Scripting Multi-Line Input/Output with CLI”If you’re using the apprise tool from the command line, you may be trying to script it to send multiple lines. To acomplish this, there are a number of tweaks you can do with bash, sh, or ksh such as:
Those who want to deliver multiple line output can use the CLI as follows:
# Send ourselves a DBus related multi-line notification using `stdin` and# the `cat` tool:cat << _EOF | apprise -vv -t "Multi-line STDIN Redirect Example" dbus://Line 1 of outputLine 2 of outputLine 3 of output_EOFAnother way is to just redirect the contents of file straight back into Apprise:
cat ~/notes.txt | apprise -vv -t "Multi-line cat STDIN Redirect Example 2" \ "email://user:pass@hotmail.com"You can also use pass content from a multi-line variable you declared:
MULTILINE_VAR="This variable has been definedwith multiple lines in it."
# Now send our variable straight into apprise:apprise -vv -t "Multi-line Variable Example" -b "$MULTILINE_VAR" \ "gotify://localhost"
# Note: to preserve the new lines, be sure to wrap your# variable in quotes (like example does above).Tmux Alert Bell Integration
Section titled “Tmux Alert Bell Integration”Users of Tmux can link their alert-bell to use Apprise like so:
# set your tmux bell-action to type 'other':set-option -g bell-action other
# now set tmux to trigger on `alert-bell` actionsset-hook -g alert-bell 'run-shell "\ apprise \ --title \"tmux finished on #{host}\" \ --body \"in session #{session_name} window #{window_index}:#{window_name}\" \ discord://webhook_id/webhook_token \ slack://TokenA/TokenB/TokenC/Channel \ twilio://AccountSid:AuthToken@FromPhoneNo"