Thread: simple default variable
i know not correct. want option variable default if option not given on command line.
running script no option:code:#!/bin/bash foo2option=1 foo1 $(foo2 --foo2option $2 $1)
would run:code:$ ./script somefile
running script option:code:foo1 $(foo2 --foo2option 1 somefile)
would run:code:$ ./script somefile 2
code:foo1 $(foo2 --foo2option 2 somefile)
have @ bash
syntax - should - likecode:${parameter-default}, ${parameter:-default}
will use 2nd command line argument $2 if set, , $default otherwisecode:#!/bin/bash default=2 echo command $1 ${2:-$default}
http://tldp.org/ldp/abs/html/paramet...stitution.html
hope legal! if not i'm sure 1 of real bashistas step in , correct me
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] simple default variable
Ubuntu
Comments
Post a Comment