Assign default parameters


/ Published in: Bash
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.