From 84498b0233ec6cdb1f8a3ba0317e212a57623d3d Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Sun, 27 May 2018 14:14:18 +0300 Subject: [PATCH] Allow running the monitor shell function with sudo. --- .bashrc | 11 +---------- Documents/bin/monitor | 9 +++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) create mode 100755 Documents/bin/monitor diff --git a/.bashrc b/.bashrc index b662d98..6db6c0a 100644 --- a/.bashrc +++ b/.bashrc @@ -86,7 +86,7 @@ alias gen-mac="hexdump -n5 -e '\"02\" 5/1 \":%02X\" \"\\n\"' /dev/urandom" alias clean-swp="find \$HOME/ -name '*.swp' -delete" alias unssh="ssh -o \"UserKnownHostsFile /dev/null\" -o \"StrictHostKeyChecking no\"" alias todo="vim \$HOME/Documents/TODO.yml" -alias sudo="sudo " +alias sudo="sudo --preserve-env=PATH" alias git="git " alias xargs="xargs " alias presentation='docker dev adarnimrod/presentation' @@ -130,15 +130,6 @@ for line in stdin.readlines(): fi } -monitor () { - if eval "$@" - then - notify-send "${1#__} has finished." - else - notify-send --urgency=critical "${1#__} has failed." - fi -} - # shellcheck disable=SC2120 json_tool () { if [ -t 0 ] diff --git a/Documents/bin/monitor b/Documents/bin/monitor new file mode 100755 index 0000000..df3645e --- /dev/null +++ b/Documents/bin/monitor @@ -0,0 +1,9 @@ +#!/bin/sh +set -eu +[ "$#" -eq "0" ] || exit 0 +if eval "$@" +then + notify-send "${1#__} has finished." +else + notify-send --urgency=critical "${1#__} has failed." +fi -- GitLab