This is a slowly growing collection of hopefully useful and reusable shell functions and patterns. https://code.jan.io/jan/jans_shell_utils
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

lib.sh 285B

1234567891011121314151617181920212223242526
  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. }