zz_deprecated:bash:common_functions
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
zz_deprecated:bash:common_functions [2022/11/16 08:18] – removed - external edit (Unknown date) 127.0.0.1 | zz_deprecated:bash:common_functions [2022/11/16 08:18] (current) – ↷ Page moved from linux:bash:common_functions to zz_deprecated:bash:common_functions dodger | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Useful bash functions ====== | ||
+ | |||
+ | |||
+ | <WRAP center round info 60%> | ||
+ | **DEPRECATED, | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== ssh_it ===== | ||
+ | |||
+ | <code bash> | ||
+ | # CONFIG SECTION | ||
+ | SSHIT=" | ||
+ | |||
+ | # FUNCTION SECTION | ||
+ | ssh_it() | ||
+ | { | ||
+ | ${SSHIT} $* 2>/ | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ===== debug_me ===== | ||
+ | <code bash> | ||
+ | debug_me() | ||
+ | { | ||
+ | if [[ ${DEBUG} -eq 0 ]] ; then | ||
+ | echo -e " | ||
+ | fi | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Dependencies: | ||
+ | * [[# | ||
+ | |||
+ | ===== check_vm ===== | ||
+ | For nutanix: | ||
+ | |||
+ | <code bash> | ||
+ | check_vm() | ||
+ | { | ||
+ | local THEVM=" | ||
+ | if [[ $(ssh_it " | ||
+ | debug_me " | ||
+ | #echo -e " | ||
+ | return 0 | ||
+ | else | ||
+ | debug_me " | ||
+ | #echo -e " | ||
+ | return 1 | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | # calling it | ||
+ | check_vm " | ||
+ | RES=$? | ||
+ | </ | ||
+ | |||
+ | Dependency: | ||
+ | * [[#ssh_it]] | ||
+ | * [[# | ||
+ | * '' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ====== bash_colors ====== | ||
+ | |||
+ | <code bash> | ||
+ | LIGHTGREEN=" | ||
+ | LIGHTRED=" | ||
+ | LIGHTBLUE=" | ||
+ | WHITE=" | ||
+ | RESET=" | ||
+ | </ | ||
+ | |||
+ | |||