Guest User

Untitled

a guest
Dec 12th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. ${parameter:-defaultValue}
  2. ${parameter:=defaultValue}
  3. ${parameter:?”ErrorMsg”}
  4. ${#var} - length of string
  5. ${var%pattern}
  6. ${var#Pattern} - Remove from $var the shortest part of $Pattern that matches the front end
  7. ${var##Pattern} - Remove from $var the longest part of $Pattern that matches the front end
  8. ${var%Pattern} - Remove from $var the shortest part of $Pattern that matches the back end
  9. ${var%%Pattern} - Remove from $var the longest part of $Pattern that matches the back end
  10. ${var:pos} - Variable var expanded, starting from offset pos.
  11. ${var:pos:len} - Expansion to a max of len characters of variable var, from offset pos
  12. ${var/Pattern/Replacement} - First match of Pattern, within var replaced with Replacement.
  13. ${var//Pattern/Replacement} - Global replacement. All matches of Pattern, within var replaced.
  14. ${var/#Pattern/Replacement} - If prefix of var matches Pattern, then substitute Replacement for Pattern.
  15. ${var/%Pattern/Replacement} - If suffix of var matches Pattern, then substitute Replacement for Pattern.
  16. ${!varprefix*}, ${!varprefix@} - Matches names of all previously declared variables beginning with varprefix.
  17. numeric validation = [[ $var == ${var//[^0-9]/} ]] || echo “Not numeric”
Add Comment
Please, Sign In to add comment