This is a slowly growing collection of hopefully useful and reusable shell functions and patterns. https://code.jan.io/jan/jans_shell_utils
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

27 lignes
285B

  1. function debug () {
  2. if [ -n "$DEBUG" ]; then
  3. echo "$1"
  4. fi
  5. }
  6. function debug_inline () {
  7. if [ -n "$DEBUG" ]; then
  8. printf "$1"
  9. fi
  10. }
  11. function error_and_exit () {
  12. echo $1 || "error"
  13. exit 1
  14. }
  15. function assert_arg () {
  16. arg=$1
  17. if [ -z "$arg" ]; then
  18. return 1
  19. fi
  20. return 0
  21. }