@@ -159,7 +159,7 @@ show_list() {
159159is_test () {
160160 case $1 in
161161 number)
162- echo $2 | egrep ' ^[1-9][0-9]?+$'
162+ echo $2 | grep -E ' ^[1-9][0-9]?+$'
163163 ;;
164164 port)
165165 if [[ $( is_test number $2 ) ]]; then
@@ -170,13 +170,13 @@ is_test() {
170170 [[ $( is_port_used $2 ) && ! $is_cant_test_port ]] && echo ok
171171 ;;
172172 domain)
173- echo $2 | egrep -i ' ^\w(\w|\-|\.)?+\.\w+$'
173+ echo $2 | grep -E -i ' ^\w(\w|\-|\.)?+\.\w+$'
174174 ;;
175175 path)
176- echo $2 | egrep -i ' ^\/\w(\w|\-|\/)?+\w$'
176+ echo $2 | grep -E -i ' ^\/\w(\w|\-|\/)?+\w$'
177177 ;;
178178 uuid)
179- echo $2 | egrep -i ' [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
179+ echo $2 | grep -E -i ' [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
180180 ;;
181181 esac
182182
@@ -781,7 +781,7 @@ add() {
781781 ;;
782782 * )
783783 for v in ${protocol_list[@]} ; do
784- [[ $( egrep -i " ^$is_lower $" <<< $v ) ]] && is_new_protocol=$v && break
784+ [[ $( grep -E -i " ^$is_lower $" <<< $v ) ]] && is_new_protocol=$v && break
785785 done
786786
787787 [[ ! $is_new_protocol ]] && err " 无法识别 ($1 ), 请使用: $is_core add [protocol] [args... | auto]"
@@ -905,7 +905,7 @@ add() {
905905 is_tmp_use_name=加密方式
906906 is_tmp_list=${ss_method_list[@]}
907907 for v in ${is_tmp_list[@]} ; do
908- [[ $( egrep -i " ^${is_use_method} $" <<< $v ) ]] && is_tmp_use_type=$v && break
908+ [[ $( grep -E -i " ^${is_use_method} $" <<< $v ) ]] && is_tmp_use_type=$v && break
909909 done
910910 [[ ! ${is_tmp_use_type} ]] && {
911911 warn " (${is_use_method} ) 不是一个可用的${is_tmp_use_name} ."
@@ -1033,8 +1033,8 @@ get() {
10331033 file)
10341034 is_file_str=$2
10351035 [[ ! $is_file_str ]] && is_file_str=' .json$'
1036- # is_all_json=("$(ls $is_conf_dir | egrep $is_file_str)")
1037- readarray -t is_all_json <<< " $(ls $is_conf_dir | egrep -i " $is_file_str " | sed '/dynamic-port-.*-link/d' | head -233)" # limit max 233 lines for show.
1036+ # is_all_json=("$(ls $is_conf_dir | grep -E $is_file_str)")
1037+ readarray -t is_all_json <<< " $(ls $is_conf_dir | grep -E -i " $is_file_str " | sed '/dynamic-port-.*-link/d' | head -233)" # limit max 233 lines for show.
10381038 [[ ! $is_all_json ]] && err " 无法找到相关的配置文件: $2 "
10391039 [[ ${# is_all_json[@]} -eq 1 ]] && is_config_file=$is_all_json && is_auto_get_config=1
10401040 [[ ! $is_config_file ]] && {
@@ -1071,7 +1071,7 @@ get() {
10711071 is_config_name=$is_config_file
10721072
10731073 if [[ $is_caddy && $host && -f $is_caddy_conf /$host .conf ]]; then
1074- is_tmp_https_port=$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1074+ is_tmp_https_port=$( grep -E -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
10751075 fi
10761076 [[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port
10771077 [[ $is_client && $host ]] && port=$is_https_port
@@ -1206,11 +1206,6 @@ get() {
12061206 [[ $( grep " :" <<< $ip ) ]] && is_dns_type=" aaaa"
12071207 is_host_dns=$( _wget -qO- --header=" accept: application/dns-json" " https://one.one.one.one/dns-query?name=$host &type=$is_dns_type " )
12081208 ;;
1209- log | logerr)
1210- msg " \n 提醒: 按 $( _green Ctrl + C) 退出\n"
1211- [[ $1 == ' log' ]] && tail -f $is_log_dir /access.log
1212- [[ $1 == ' logerr' ]] && tail -f $is_log_dir /error.log
1213- ;;
12141209 install-caddy)
12151210 _green " \n安装 Caddy 实现自动配置 TLS.\n"
12161211 load download.sh
@@ -1652,7 +1647,8 @@ main() {
16521647 load import.sh
16531648 ;;
16541649 log)
1655- get $@
1650+ load log.sh
1651+ log_set $2
16561652 ;;
16571653 url | qr)
16581654 url_qr $@
0 commit comments