summaryrefslogtreecommitdiff
path: root/build-0.3/run-if-arg
blob: 819a3cb5069b2ba6fec5d7bedf5d1e616e9b209b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env bash

# file      : build/run-if-arg
# author    : Boris Kolpackov <boris@codesynthesis.com>
# copyright : Copyright (c) 2004-2010 Code Synthesis Tools CC
# license   : GNU GPL v2; see accompanying LICENSE file

# Run command if there are any non-empty arguments.
#
# $1 command to execute
# $2 argument to test

cmd=$1
shift

if [ "$*" ]; then
  exec $cmd $*
fi