2020-02-14 04:06:18 +00:00
|
|
|
#!/usr/bin/env bash
|
2020-02-14 05:33:44 +00:00
|
|
|
main(){
|
2020-02-14 04:06:18 +00:00
|
|
|
check_arg $1
|
2020-02-14 05:33:44 +00:00
|
|
|
ask_question "you are uninstalling photoshop cc v19 are you sure?" "N"
|
2020-02-14 04:06:18 +00:00
|
|
|
}
|
|
|
|
|
2020-02-14 05:33:44 +00:00
|
|
|
error(){
|
2020-02-14 04:06:18 +00:00
|
|
|
echo -e "\033[1;31merror:\e[0m $@"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
check_arg(){
|
|
|
|
if [ $1 != 0 ];then
|
|
|
|
error "please just run script without any argument"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-02-14 05:33:44 +00:00
|
|
|
#parameters [Message] [default flag [Y/N]]
|
|
|
|
function ask_question(){
|
|
|
|
result=""
|
|
|
|
if [ "$2" == "Y" ];then
|
|
|
|
read -r -p "$1 [Y/n] " response
|
|
|
|
if [[ "$response" =~ $(locale noexpr) ]];then
|
|
|
|
result="no"
|
|
|
|
else
|
|
|
|
result="yes"
|
|
|
|
fi
|
|
|
|
elif [ "$2" == "N" ];then
|
|
|
|
read -r -p "$1 [N/y] " response
|
|
|
|
if [[ "$response" =~ $(locale yesexpr) ]];then
|
|
|
|
result="yes"
|
|
|
|
else
|
|
|
|
result="no"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-02-14 04:06:18 +00:00
|
|
|
main $# $@
|