Advertisement
metalx1000

BASH Fallback to default variable

Mar 15th, 2019
807
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.17 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #set candy to first argument
  4. #default to Twix is none are given
  5. #candy="${@:-Twix}" #for all arguments
  6. candy="${1:-Twix}"
  7. echo "Candy Selected, $candy!"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement