From ecfa55737c42c9cc23196080b29dba42f1f9fa99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=A4chler?= Date: Sat, 23 Dec 2017 22:48:54 +0100 Subject: [PATCH] Improve make_bit example Use the '-z' option of the 'test' command to check whether 'MSG' is a string of zero length. Do not test the variable 'MSG' twice, return '1' by using the 'false' command in the first 'if' statement. In this way the 'push' target is aborted right after printing the reminder. There is no need to test it once again. --- make_bit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/make_bit b/make_bit index 834ba3e..5031747 100644 --- a/make_bit +++ b/make_bit @@ -1,7 +1,6 @@ push: - @if [ "x$(MSG)" = 'x' ] ; then \ - echo "Usage: MSG='your message here.' make push"; fi - @test "x$(MSG)" != 'x' + @if [ -z "$(MSG)" ]; then \ + echo "Usage: MSG='your message here.' make push"; false; fi git commit -a -m "$(MSG)" git svn fetch git svn rebase -- GitLab