# unix-shell-script-kit Unix shell script kit. POSIX. Functions, exit codes, color codes, utilties, helpers, tools. https://raw.githubusercontent.com/SixArm/unix-shell-script-kit/main/unix-shell-script-kit Functions: - color -> true or false - out -> message - err -> message - die - big - zid -> <32-bit secure random lowercase hex identifier> - ask -> - utf8 -> true or false - print_success - print_warning - print_failure - now -> - now_date -> - sec -> - age -> - age_lt -> true or false - age_gt -> true or false - leap_year -> true or false - datetime_mday_max -> true or false - datetime_format_for_at_command -> - datetime_format_for_pmset_command -> - datetime_add -> - directory_exists -> true or false - directory_exists_or_die -> true or die - file_exists -> true or false - file_exists_or_die -> true or die - symlink_exists -> true or false - symlink_exists_or_die -> true or die - command_exists -> true or false - command_exists_or_die -> true or die - command_version_exists -> true or false - command_version_exists_or_die -> true or die - var_exists -> true or false - var_exists_or_die -> true or die - version -> true or false - version_or_die -> true or die - int -> integer - sum ... -> sum of numbers - cmp_alnums -> 0 or -1 or 1 - cmp_digits -> 0 or -1 or 1 - dot_all -> source all executable files - run_all -> run all executable files - sh_all -> shell all executable files - rm_all -> remove all files - trim -> string without leading/trailing spaces - slug -> string with solely lowercase and single internal dash characters - slugs -> string with solely lowercase and single internal dash characters and slash characters - upper_case -> string with uppercase not lowercase - lower_case -> string with lowercase nor uppercase - kebab_case -> string with solely alphanumeric and single internal dash characters - snake_case -> string with solely alphanumeric and single internal underscore characters - space_case -> string with solely solely alphanumeric and single internal space characters - touch_case -> string with solely a command "touch -t" timestamp format - select_character_class [offset [length]] -> selected characters - reject_character_class [offset [length]] -> rejected characters - random_char [characters [length]] -> random characters - random_char_alnum [length] -> random characters in class [:alnum:] - random_char_alpha [length] -> random characters in class [:alpha:] - random_char_blank [length] -> random characters in class [:blank:] - random_char_cntrl [length] -> random characters in class [:cntrl:] - random_char_digit [length] -> random characters in class [:digit:] - random_char_graph [length] -> random characters in class [:graph:] - random_char_lower [length] -> random characters in class [:lower:] - random_char_lower_digit [length] -> random characters in classes [:lower:][:digit] - random_char_upper [length] -> random characters in class [:upper:] - random_char_upper_digit [length] -> random characters in classes [:upper:][:digit] - random_char_space [length] -> random characters in class [:space:] - random_char_xdigit [length] -> random characters in class [:xdigit:] - array_n -> number of fields - array_i -> array element at index - array_first -> array first element - array_last -> array last element - array_car -> array car element - array_cdr -> array cdr elements - mktemp_dir -> temporary directory path - mktemp_file -> temporary file path - file_media_type -> media type - file_media_type_supertype -> media type supertype - file_media_type_subtype -> media type subtype - font_name_exists -> true or false - font_name_exists_or_die -> true or die - file_ends_with_newline -> true or false - user_dir -> directory path Color codes: - COLOR_RESET - COLOR_BLACK - COLOR_RED - COLOR_GREEN - COLOR_YELLOW - COLOR_BLUE - COLOR_MAGENTA - COLOR_CYAN - COLOR_WHITE - COLOR_BG_BLACK - COLOR_BG_RED - COLOR_BG_GREEN - COLOR_BG_YELLOW - COLOR_BG_BLUE - COLOR_BG_MAGENTA - COLOR_BG_CYAN - COLOR_BG_WHITE Exit codes: - EXIT_SUCCESS=0 - EXIT_FAILURE=1 - EXIT_USAGE=2 - EXIT_DATAERR=65 - EXIT_NOINPUT=66 - EXIT_NOUSER=67 - EXIT_NOHOST=68 - EXIT_UNAVAILABLE=69 - EXIT_SOFTWARE=70 - EXIT_OSERR=71 - EXIT_OSFILE=72 - EXIT_CANTCREATE=73 - EXIT_IOERR=74 - EXIT_TEMPFAIL=75 - EXIT_PROTOCOL=76 - EXIT_NOPERM=77 - EXIT_CANTCREATE=73 - EXIT_CONFIG=78 - EXIT_QUIT=80 - EXIT_KYC=81 - EXIT_UPDATE=89 - EXIT_CONFLICT=90 - EXIT_UNLAWFUL=91 - EXIT_PAYMENT_ISSUE=92 - EXIT_QUOTA_ISSUE=93 - EXIT_BUSY=100 - EXIT_TIMEOUT=101 - EXIT_LOCKOUT=102 - EXIT_LOOP=103 - EXIT_MOVED_PERMANENTLY=110 - EXIT_MOVED_TEMPORARILY=111 - EXIT_GONE=112 - EXIT_FUTURE=119 - EXIT_GIT_BISECT_SKIP=125 - EXIT_COMMAND_FOUND_BUT_NOT_EXECUTABLE=126 - EXIT_COMMAND_NOT_FOUND=127 - EXIT_CODE_INVALID=128 - EXIT_CODE_OUT_OF_RANGE=255 Assert testing: - assert_test - assert_empty - assert_not_empty - assert_int_eq - assert_int_ne - assert_int_ge - assert_int_gt - assert_int_le - assert_int_lt - assert_str_eq - assert_str_ne - assert_str_ge - assert_str_gt - assert_str_le - assert_str_lt - assert_str_starts_with - assert_str_ends_with - assert_eval_int_eq_x - assert_eval_str_eq_x