X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=logq-function;h=3744d101ffeab7e34cff643396d8377ded56175c;hb=b8de1150f378d224c51a86ee9d02050beaab8056;hp=2ae5dae47fb8ff3e14890e34760473b220837b47;hpb=ea9d543d812b5ec13d4d3c6b424626f3afaaa5dc;p=log-quiet diff --git a/logq-function b/logq-function index 2ae5dae..3744d10 100644 --- a/logq-function +++ b/logq-function @@ -1,5 +1,12 @@ #!/bin/bash -# Copyright (C) 2014-2016 Ian Kelling +# I, Ian Kelling, follow the GNU license recommendations at +# https://www.gnu.org/licenses/license-recommendations.en.html. They +# recommend that small programs, < 300 lines, be licensed under the +# Apache License 2.0. This file contains or is part of one or more small +# programs. If a small program grows beyond 300 lines, I plan to switch +# its license to GPL. + +# Copyright 2024 Ian Kelling # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,6 +19,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + logq () { local help="Usage: logq [-h|--help] COMMAND [ARG...] @@ -45,11 +53,12 @@ $help" printf "%s\n%s\n\n" "Log of $prettycommand" "$(date)" >"$file" if [[ $- != *x* ]]; then - echo "log $file = $@" + echo "log $file = $*" fi # we will propagate any errors - local logq_ret=$( + local logq_ret + logq_ret=$( set +e trap ERR "$@" &>> "$file"