From feae1e052ede35ca02a4643e91d60eb33e876bb2 Mon Sep 17 00:00:00 2001 From: Benjamin C Meyer Date: Mon, 17 Feb 2014 22:49:23 -0500 Subject: Don't output error when checking files that have been removed and don't exists. Signed-off-by: Benjamin C Meyer --- contrib/pre-commit/bash_syntax | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'contrib/pre-commit/bash_syntax') diff --git a/contrib/pre-commit/bash_syntax b/contrib/pre-commit/bash_syntax index 5fecbfe..c2724b4 100755 --- a/contrib/pre-commit/bash_syntax +++ b/contrib/pre-commit/bash_syntax @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 2010, Benjamin C. Meyer +# Copyright (c) 2010-2014, Benjamin C. Meyer # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -28,6 +28,9 @@ function test_file { file="${1}" + if [ ! -f "${file}" ] ; then + return + fi head -n 1 "${file}" | grep 'bash' | grep '^#!/' > /dev/null if [ "$?" -eq 0 ] ; then set -e -- cgit v1.2.3