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

# file      : build/run-if-arg
# copyright : Copyright (c) 2004-2012 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