init commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Логирование сообщения со статусом
|
||||
log() {
|
||||
local res=$?
|
||||
local mes=$@
|
||||
|
||||
case "${res}" in
|
||||
0 ) mes="[ Ok ] "${mes} ;;
|
||||
* ) mes="[ Fail ] "${mes} ;;
|
||||
esac
|
||||
|
||||
echo -e ${mes}
|
||||
|
||||
return ${res}
|
||||
}
|
||||
|
||||
log_error() {
|
||||
false
|
||||
log $@
|
||||
return 1
|
||||
}
|
||||
|
||||
# Сообщение с подтверждением
|
||||
confirm() {
|
||||
mes="$@"
|
||||
read -p "$mes (y/n): " res
|
||||
if [[ "${res}" == "y" || "${res}" == "yes" ]]; then return 0; else return 1; fi
|
||||
}
|
||||
Reference in New Issue
Block a user