We use the command which to determine if a command is available on the system. However, which is not installed on all platforms by default (e.g. CentOS). command is a shell builtin that can be used for the same purpose.
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
webget https://www.antlr3.org/download/antlr-3.4-complete.jar share/java/antlr-3.4-complete.jar
webget https://www.antlr3.org/download/C/libantlr3c-3.4.tar.gz src/libantlr3c-3.4.tar.gz
tee bin/antlr3 <<EOF
-#!/bin/bash
+#!/usr/bin/env bash
export CLASSPATH=`pwd`/share/java/antlr-3.4-complete.jar:\$CLASSPATH
exec java org.antlr.Tool "\$@"
EOF
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
if [ -e drat2er ]; then
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
-#!/bin/bash
+#!/usr/bin/env bash
#
# This script should only be used if your distribution does not ship with the
# GMP configuration you need. For example, contrib/get-win-dependencies
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
dirname="lfsc-checker"
function gitclone {
- if which git &> /dev/null
+ if [ -x "$(command -v git)" ]
then
git clone "$1" "$2"
else
fi
function webget {
- if which wget &>/dev/null; then
+ if [ -x "$(command -v wget)" ]; then
wget -c -O "$2" "$1"
- elif which curl &>/dev/null; then
+ elif [ -x "$(command -v curl)" ]; then
curl -L "$1" >"$2"
else
echo "Can't figure out how to download from web. Please install wget or curl." >&2
-#!/bin/bash
+#!/usr/bin/env bash
#
source "$(dirname "$0")/get-script-header.sh"
-#!/bin/bash
+#!/usr/bin/env bash
#
# win32-build script
# Morgan Deters <mdeters@cs.nyu.edu>
# Tue, 15 Jan 2013 11:11:24 -0500
#
+set -e -o pipefail
+
export WINDOWS_BUILD=yes
export MAKE_CFLAGS=
export MAKE_CXXFLAGS=
}
function webget {
- if which curl &>/dev/null; then
- curl -L "$1" >"$2"
- elif which wget &>/dev/null; then
+ if [ -x "$(command -v wget)" ]; then
wget -c -O "$2" "$1"
+ elif [ -x "$(command -v curl)" ]; then
+ curl -L "$1" >"$2"
else
echo "Can't figure out how to download from web. Please install wget or curl." >&2
exit 1