X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fsc;h=34746fa052239dd62720e9ee0c6846ebacc50460;hb=HEAD;hp=506e90adc99ee29db12ae38aee44cecff4a7f89a;hpb=843ce28bcb3395a862bdb8fef45203b284364e3c;p=config%2Fdotfiles.git diff --git a/bin/sc b/bin/sc deleted file mode 100755 index 506e90a..0000000 --- a/bin/sc +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# Small wrapper for systemctl which provides some shortcuts. - -# Copyright (C) 2015 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -set -eu - - -args=( ) -found= -for arg; do - # This heuristic replaces the first occurrence of a shortcut with its - # expansion. This is not perfect (e.g. `systemctl status s` would result - # in `systemctl status status`) but works even when options are used and - # doesn't require us to duplicate systemctl's parsing of command line - # arguments. - if [[ -z $found ]]; then - found=1 - case "$arg" in - c) arg=cat ;; - d) arg=disable ;; - e) arg=enable ;; - k) arg=kill ;; - m) arg=mask ;; - r) arg=restart ;; - rl) arg=reload ;; - s) arg=status ;; - sa) arg=start ;; - so) arg=stop ;; - u) arg=unmask ;; - # No match, try it again for the next parameter. - *) found= ;; - esac - fi - args+=( "$arg" ) -done - -set +u # empty $args causes an error, I think this is a bug in bash -exec systemctl "${args[@]}"