From 1bc5eea5274881a299da19ff5df1c7ddc61cbe93 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 13 Aug 2016 23:38:11 +0200 Subject: fix ShellCheck warnings --- .bashrc_third_party | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to '.bashrc_third_party') diff --git a/.bashrc_third_party b/.bashrc_third_party index cddbb6c..6d1e28c 100644 --- a/.bashrc_third_party +++ b/.bashrc_third_party @@ -1,28 +1,30 @@ -[ ! -z "${BASHRC_THIRD_PARTY+x}" ] && return || readonly BASHRC_THIRD_PARTY=1 +#!/usr/bin/env bash -ensure_symlinks_enabled() { - [ -z "${CYGWIN+x}" ] && return 1 +if [ -n "${BASHRC_THIRD_PARTY+x}" ]; then + return 0 +else + readonly BASHRC_THIRD_PARTY=1 +fi - case "$CYGWIN" in +ensure_symlinks_enabled() { + case "${CYGWIN:-}" in *winsymlinks:native*) ;; *winsymlinks:nativestrict*) ;; *) + echo "${FUNCNAME[0]}: native Windows symlinks aren't enabled in Cygwin" >&2 return 1 ;; esac } symlink_preferences() ( - if ! ensure_symlinks_enabled; then - echo "$FUNCNAME: it seems like native Windows symlinks aren't enabled in Cygwin." >&2 - return 1 - fi - set -o errexit + ensure_symlinks_enabled + if [ "$#" -ne 2 ]; then - echo "usage: $FUNCNAME SRC_DIR DEST_DIR" >&2 + echo "usage: ${FUNCNAME[0]} SRC_DIR DEST_DIR" >&2 return 1 fi -- cgit v1.2.3