This is a slowly growing collection of hopefully useful and reusable shell functions and patterns. https://code.jan.io/jan/jans_shell_utils
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
3 anos atrás
123456789101112131415161718192021222324252627
  1. # Copyright (c) 2022 Jan Lehnardt <jan@apache.org>, MIT licensed
  2. debug () {
  3. if [ -n "$DEBUG" ]; then
  4. echo "$1"
  5. fi
  6. }
  7. debug_inline () {
  8. if [ -n "$DEBUG" ]; then
  9. printf "$1"
  10. fi
  11. }
  12. error_and_exit () {
  13. echo $1 || "error"
  14. exit 1
  15. }
  16. assert_arg () {
  17. arg=$1
  18. if [ -z "$arg" ]; then
  19. return 1
  20. fi
  21. return 0
  22. }