@@ -167,7 +167,7 @@ show_list() {
167167is_test () {
168168 case $1 in
169169 number)
170- echo $2 | egrep ' ^[1-9][0-9]?+$'
170+ echo $2 | grep -E ' ^[1-9][0-9]?+$'
171171 ;;
172172 port)
173173 if [[ $( is_test number $2 ) ]]; then
@@ -178,13 +178,13 @@ is_test() {
178178 [[ $( is_port_used $2 ) && ! $is_cant_test_port ]] && echo ok
179179 ;;
180180 domain)
181- echo $2 | egrep -i ' ^\w(\w|\-|\.)?+\.\w+$'
181+ echo $2 | grep -E -i ' ^\w(\w|\-|\.)?+\.\w+$'
182182 ;;
183183 path)
184- echo $2 | egrep -i ' ^\/\w(\w|\-|\/)?+\w$'
184+ echo $2 | grep -E -i ' ^\/\w(\w|\-|\/)?+\w$'
185185 ;;
186186 uuid)
187- echo $2 | egrep -i ' [0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}'
187+ 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}'
188188 ;;
189189 esac
190190
@@ -911,7 +911,7 @@ add() {
911911 ;;
912912 * )
913913 for v in ${protocol_list[@]} ; do
914- [[ $( egrep -i " ^$is_lower $" <<< $v ) ]] && is_new_protocol=$v && break
914+ [[ $( grep -E -i " ^$is_lower $" <<< $v ) ]] && is_new_protocol=$v && break
915915 done
916916
917917 [[ ! $is_new_protocol ]] && err " 无法识别 ($1 ), 请使用: $is_core add [protocol] [args... | auto]"
@@ -1061,7 +1061,7 @@ add() {
10611061 ask set_header_type
10621062 }
10631063 for v in ${is_tmp_list[@]} ; do
1064- [[ $( egrep -i " ^${is_use_header_type}${is_use_method} $" <<< $v ) ]] && is_tmp_use_type=$v && break
1064+ [[ $( grep -E -i " ^${is_use_header_type}${is_use_method} $" <<< $v ) ]] && is_tmp_use_type=$v && break
10651065 done
10661066 [[ ! ${is_tmp_use_type} ]] && {
10671067 warn " (${is_use_header_type}${is_use_method} ) 不是一个可用的${is_tmp_use_name} ."
@@ -1198,8 +1198,8 @@ get() {
11981198 file)
11991199 is_file_str=$2
12001200 [[ ! $is_file_str ]] && is_file_str=' .json$'
1201- # is_all_json=("$(ls $is_conf_dir | egrep $is_file_str)")
1202- 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.
1201+ # is_all_json=("$(ls $is_conf_dir | grep -E $is_file_str)")
1202+ 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.
12031203 [[ ! $is_all_json ]] && err " 无法找到相关的配置文件: $2 "
12041204 [[ ${# is_all_json[@]} -eq 1 ]] && is_config_file=$is_all_json && is_auto_get_config=1
12051205 [[ ! $is_config_file ]] && {
@@ -1244,7 +1244,7 @@ get() {
12441244 [[ $? != 0 ]] && err " 无法读取动态端口文件: $is_dynamic_port "
12451245 fi
12461246 if [[ $is_caddy && $host && -f $is_caddy_conf /$host .conf ]]; then
1247- is_tmp_https_port=$( egrep -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
1247+ is_tmp_https_port=$( grep -E -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
12481248 fi
12491249 [[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port
12501250 [[ $is_client && $host ]] && port=$is_https_port
@@ -1849,8 +1849,9 @@ main() {
18491849 get_ip
18501850 msg $ip
18511851 ;;
1852- log | logerr)
1853- get $@
1852+ log | logerr | errlog)
1853+ load log.sh
1854+ log_set $@
18541855 ;;
18551856 url | qr)
18561857 url_qr $@
0 commit comments