From patchwork Mon Feb 29 18:30:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 11142 Received: (qmail 105815 invoked by alias); 29 Feb 2016 18:30:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 95379 invoked by uid 89); 29 Feb 2016 18:30:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=refusing X-HELO: usplmg21.ericsson.net Received: from usplmg21.ericsson.net (HELO usplmg21.ericsson.net) (198.24.6.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 29 Feb 2016 18:30:13 +0000 Received: from EUSAAHC008.ericsson.se (Unknown_Domain [147.117.188.96]) by usplmg21.ericsson.net (Symantec Mail Security) with SMTP id 56.B0.32102.71E84D65; Mon, 29 Feb 2016 19:29:44 +0100 (CET) Received: from elxcz23q12-y4.dyn.mo.ca.am.ericsson.se (147.117.188.8) by smtps-am.internal.ericsson.com (147.117.188.96) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 29 Feb 2016 13:30:10 -0500 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH] feature_to_c.sh: Print help when passing no arguments Date: Mon, 29 Feb 2016 13:30:06 -0500 Message-ID: <1456770606-2944-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-IsSubscribed: yes I found that odd that passing no arguments to feature_to_c.sh produces this: $ ./feature_to_c.sh ./feature_to_c.sh: 23: shift: can't shift that many but passing one argument shows the help: $ ./feature_to_c.sh hello Usage: ./feature_to_c.sh OUTPUTFILE INPUTFILE... This patch changes the script to show the help in both cases. gdb/ChangeLog: * features/feature_to_c.sh: Print the help when passing no argument. --- gdb/features/feature_to_c.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gdb/features/feature_to_c.sh b/gdb/features/feature_to_c.sh index 901eb0d..439611a 100755 --- a/gdb/features/feature_to_c.sh +++ b/gdb/features/feature_to_c.sh @@ -19,14 +19,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -output=$1 -shift - -if test -z "$output" || test -z "$1"; then +if test -z "$1" || test -z "$2"; then echo "Usage: $0 OUTPUTFILE INPUTFILE..." exit 1 fi +output=$1 +shift + if test -e "$output"; then echo "Output file \"$output\" already exists; refusing to overwrite." exit 1