From: Simon Ruderich Date: Fri, 26 Jul 2019 05:34:08 +0000 (+0200) Subject: shell: redirect stderr to stdout for systemd aliases/functions X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=3d5c932538a21d556c8266bf0a465bb5ca148dbd;p=config%2Fdotfiles.git shell: redirect stderr to stdout for systemd aliases/functions --- diff --git a/shell/bin/sc b/shell/bin/sc index 506e90a..34746fa 100755 --- a/shell/bin/sc +++ b/shell/bin/sc @@ -2,7 +2,7 @@ # Small wrapper for systemctl which provides some shortcuts. -# Copyright (C) 2015 Simon Ruderich +# Copyright (C) 2015-2019 Simon Ruderich # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -50,4 +50,4 @@ for arg; do done set +u # empty $args causes an error, I think this is a bug in bash -exec systemctl "${args[@]}" +exec systemctl "${args[@]}" 2>&1 diff --git a/shell/shell/aliases.in b/shell/shell/aliases.in index a2f0341..0076a56 100644 --- a/shell/shell/aliases.in +++ b/shell/shell/aliases.in @@ -44,9 +44,15 @@ alias sa=ssh-add alias ta=task alias te=tree alias ti=timew -# systemd ... (sc is provided as shell script for better completion) -alias jc=journalctl -alias lc=loginctl + +# systemd ... (sc is provided as shell script for better completion); redirect +# stderr because my color-stderr hack breaks systemd's terminal detection. +jc() { + journalctl "$@" 2>&1 +} +lc() { + loginctl "$@" 2>&1 +} unalias mv cp 2>/dev/null