Posted By

miceno on 01/03/11


Tagged

default commandline parameter


Versions (?)

Assign default parameters


 / Published in: Bash
 

Assigns a default value to VARIABLE in case there is no positional parameter

  1. #!/bin/bash
  2.  
  3. # Assigns a default value to VARIABLE in case no value of $1
  4. VARIABLE=${1:-default_value}

Report this snippet  

You need to login to post a comment.