bash variable set default value

Yeaaa :-) Yesterday i've found a nice way to set an default value for bash variables.
I use this way if parameter 1 isn't assigned by the user. Here a small example:
ip=${1-'10.1.1.1'}

If $1 isn't assigned by the user the default 10.1.1.1 is set as value of $ip.

Posted

March 29, 2008, 12:24 pm

Tags

,

More

Permalink

Comments

Send your comment by mail.