-1

I've found this in a shell script that I use and I'm having trouble finding a formal description/definition of this syntax:

ACTION=${1:-update}

I'm assuming that if $1 variable does not exist (no command line arguments) then "-update" is used.

erk
  • 461
  • 2
  • 9
  • 1
    Exact duplicates: [1](http://stackoverflow.com/q/10390406/495451), [2](http://stackoverflow.com/q/10287197/495451) – ormaaj Mar 18 '13 at 21:44

1 Answers1

1

It's not esoteric. It's POSIX, and even Bourne. In every shell manpage ever. man bash or man ksh. The assumption is mostly right, if the parameter 1 is unset or empty string, then expand the alternate.

ormaaj
  • 6,201
  • 29
  • 34