From 3d5c932538a21d556c8266bf0a465bb5ca148dbd Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 26 Jul 2019 07:34:08 +0200 Subject: [PATCH] shell: redirect stderr to stdout for systemd aliases/functions --- shell/bin/sc | 4 ++-- shell/shell/aliases.in | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) 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 -- 2.43.2