X-Git-Url: https://iankelling.org/git/?p=log-quiet;a=blobdiff_plain;f=logq-function;h=a18319f680a598d63df02db2c435d22a18b2487b;hp=2ae5dae47fb8ff3e14890e34760473b220837b47;hb=HEAD;hpb=f63a62a9ae726155d06b2ca2fc2b576a1dd11289 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"