From owner-freebsd-questions@freebsd.org Sun Sep 20 18:11:43 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C762F3E96B0 for ; Sun, 20 Sep 2020 18:11:43 +0000 (UTC) (envelope-from bourne.identity@hotmail.com) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04olkn082a.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::82a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BvbHf4XDBz3c0d for ; Sun, 20 Sep 2020 18:11:42 +0000 (UTC) (envelope-from bourne.identity@hotmail.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MADR9oFZenlDSRZmIqU4f8ecqMp7kXkhRJVSUiuHOt57wAf7Od62mmB1oe9RSSJP+loNUPMWl0BAlxA26nlJoNFe2+JZZ5/2i6ua6ScrVhbnQDZYEtSwAVW/uqp7/kXRmk5ml7l2tDeyGHbf2ekgyTnKT6gNq4+4OETp1JyDw/geeCc/x5eIUUpLGR1lXyN9MNgTkWLHmJGig/5DqFkp5JItvVn7EA3HxL3iN8v9ZXO/DaxJEFpEcyN8B77XMpqaZpW9i/nNnj9SY9VxOCtncR4dQu2TjBrMFhbwy7v7qzdJJSIxXArs5UgHDvv625a52gS4xez/k5MF4UP5W/2P+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vsuo+Yp/kLOMV5QEPr4JlzyvC/Ty36w9hXYDRc1N15Q=; b=k0QYfgl/M/Xa1qqSe7fIOysfJ6EtdAzcWpoPZnXR5B6Ap9w+Vs7wQQ+/+rdqCOkSUtbSKa2q317Dax0ywQXsCuxf9Hx2t3Esq+sAReJmJY2nXrzb0KePrTFvFnEnqiShsGAFBysClBCpe3fXHeeeADqK4gMmgFVd8LeHDtSrNXcThIrJglWKWt3dQodxnmiSBDJP4ecvXDrIKKWiEHVV6iS2mWMzQK+gB2f+v5bXY7aV6d/NuAdXkbSnPHWwSx8eOz66apqJAyOPpWxmiCVnj+q3UEjGeYXnel6/cNZhihBXgi0ev8HZOw69lPyeW4Z0E033ZKRIYBGZAZbUiJyMMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vsuo+Yp/kLOMV5QEPr4JlzyvC/Ty36w9hXYDRc1N15Q=; b=H/0peEJg45416/RsXr8UfHpSeoxM+lmgATc5v+gIm063fPWsV2p+e2UV+sGqgrtVxetFMKbWXsHSPtcZnjwvPp2tnYOW/QPpnCQHN8MK0puMAE8ivrVj8rb2iYdU1FA3n3umKIJKiop0uvFzNUpnqWSyV+tIEB68HhuuUeCbMx4SivFOV2HOUFJHRFg7aArbBahBCV77dAzSY4FSVLWLIRoholec+4AhGIh99p0JWHKbIlIofboCQHyYokOIBVG42nMF/YAaAQ9aQKrfW+j6gAdan4TjwrpO2M3G4IR/tQB8a/+cKZ8flBNWJeP9uwhWrIBulld3yWscAOGd8ywBHA== Received: from VI1EUR04FT005.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::48) by VI1EUR04HT047.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0e::349) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.15; Sun, 20 Sep 2020 17:57:01 +0000 Received: from DB8PR06MB6442.eurprd06.prod.outlook.com (2a01:111:e400:7e0e::43) by VI1EUR04FT005.mail.protection.outlook.com (2a01:111:e400:7e0e::65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.15 via Frontend Transport; Sun, 20 Sep 2020 17:57:01 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:9BE4C04E09748C33CE21E3FCD1F98C6CAD2BE6076CEBCDCE63FFD1B1031308DC; UpperCasedChecksum:06327F4CB17F8ED974FE77D7DC97903FFC18C60E3C9B36FF90D076F1A9DEACD4; SizeAsReceived:8722; Count:48 Received: from DB8PR06MB6442.eurprd06.prod.outlook.com ([fe80::71dd:33c7:29cb:19ea]) by DB8PR06MB6442.eurprd06.prod.outlook.com ([fe80::71dd:33c7:29cb:19ea%7]) with mapi id 15.20.3391.011; Sun, 20 Sep 2020 17:57:01 +0000 Subject: Re: Error message output To: Polytropon , FreeBSD Questions References: <20200920191108.22864e5c.freebsd@edvax.de> From: Manish Jain Message-ID: Date: Sun, 20 Sep 2020 23:26:55 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 In-Reply-To: <20200920191108.22864e5c.freebsd@edvax.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BM1PR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::28) To DB8PR06MB6442.eurprd06.prod.outlook.com (2603:10a6:10:126::7) X-Microsoft-Original-Message-ID: <9c08200a-fe2b-f297-bf6b-fc9f5b55c59f@hotmail.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.1.2] (45.127.45.49) by BM1PR0101CA0066.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00:19::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14 via Frontend Transport; Sun, 20 Sep 2020 17:57:00 +0000 X-Microsoft-Original-Message-ID: <9c08200a-fe2b-f297-bf6b-fc9f5b55c59f@hotmail.com> X-TMN: [atn62T01BjC+KdpFEaAgUHmKbSIdk359] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: c940474a-9666-4944-76fb-08d85d8e933b X-MS-TrafficTypeDiagnostic: VI1EUR04HT047: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ik4+khyGM6UeXMBuy1UwHpebyh7DfbwXpq/spmTNKlzpKed7ipIRChWJ5oratZJIdf0D7tAdcWdyMA5/o65qANHlfl7f2nABETi4paUb8AIQNikXaS6LvTGTL2coONbTWUru7xADVRuwW6as+kFeJzGYWLPrgvKyZw7Qish9b5rQ+qvgQqYvqrPRUKisl7873ooXmn4h60Rm5QD8ob/esQ== X-MS-Exchange-AntiSpam-MessageData: NQHYgU3Xy9vLr3cKdJOxOAQMv0jbVZhhYIqZ3GCv5D4UCA+cM5LX2s0kJAHIomNr5crGzi95l6LxJ2HNMdYMzGTAzUeOhdmVK16CO30I4iDyh1n6EIOU6UvVONaIvuTZ5dlHhFDBHocJfgt7AJaDbQ== X-OriginatorOrg: hotmail.com X-MS-Exchange-CrossTenant-Network-Message-Id: c940474a-9666-4944-76fb-08d85d8e933b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Sep 2020 17:57:01.4949 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: VI1EUR04FT005.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1EUR04HT047 X-Rspamd-Queue-Id: 4BvbHf4XDBz3c0d X-Spamd-Bar: ++++++++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hotmail.com header.s=selector1 header.b=H/0peEJg; dmarc=pass (policy=none) header.from=hotmail.com; spf=pass (mx1.freebsd.org: domain of bourne.identity@hotmail.com designates 2a01:111:f400:fe0d::82a as permitted sender) smtp.mailfrom=bourne.identity@hotmail.com X-Spamd-Result: default: False [8.54 / 15.00]; FREEMAIL_FROM(0.00)[hotmail.com]; R_SPF_ALLOW(0.00)[+ip6:2a01:111:f400::/48]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hotmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(0.00)[hotmail.com,none]; NEURAL_HAM_SHORT(-0.05)[-0.045]; RCVD_IN_DNSWL_LOW(-0.10)[2a01:111:f400:fe0d::82a:from]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[hotmail.com]; ASN(0.00)[asn:8075, ipnet:2a01:111:f000::/36, country:US]; FORGED_MUA_THUNDERBIRD_MSGID_UNKNOWN(2.50)[]; ARC_ALLOW(0.00)[microsoft.com:s=arcselector9901:i=1]; DWL_DNSWL_NONE(0.00)[hotmail.com:dkim]; RECEIVED_SPAMHAUS_XBL(5.00)[45.127.45.49:received]; R_DKIM_ALLOW(0.00)[hotmail.com:s=selector1]; RCVD_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[text/plain]; NEURAL_SPAM_MEDIUM(0.23)[0.233]; BAD_REP_POLICIES(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_LONG(0.96)[0.955]; RECEIVED_SPAMHAUS_PBL(0.00)[45.127.45.49:received]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[freebsd-questions] X-Spam: Yes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Sep 2020 18:11:43 -0000 On 2020-09-20 22:41, Polytropon wrote: > I have a general question. Is it still considered useful to > output error messages of a script to standard error? > > Example: > > if [ something not okay ]; then > echo "the error message" > /dev/stderr > exit 1 > fi > > While progress messages will per default go to standard output, > error messages should be printed to standard error. The reason: > If a program is silenced to > /dev/null, error messages will > still be visible (no "silent failing"); if a user wants to > explicitely mute all messages, > /dev/null 2>&1 has to be > specified for the redirection. The judgement if a message is > a regular progress message, an information about some slightly > problematic case, or a real fatal error depends on the programmer. > For example: > > echo "${FILE] processed, ${RECS} records counted." > -> standard output > > echo "${DIR} already checked, skipping." > -> standard output (non-fatal error" > > echo "${DEV} is read only, aborting." > exit 1 > -> standard error (fatal error) > > echo "Cannot start: Input filename missing." > usage() > exit 1 > -> standard error (fatal error) > > At least that's what I've learned centuries ago. > > Is that still valid? > > Fully valid. Whenever I write any C code, those are the guidelines I adhere to myself. Regards, Manish Jain