aboutsummaryrefslogtreecommitdiff
path: root/build/run-if-arg
blob: 297e7d3398c0cd628ba38913ae58da881e5df017 (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-2011 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