From 318cca07169292495e46aee6764342d1b0cc4f73 Mon Sep 17 00:00:00 2001 From: juewuy Date: Sat, 3 Feb 2024 22:19:04 +0800 Subject: [PATCH] =?UTF-8?q?~=E5=A2=9E=E5=8A=A0crash=20-d=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E4=BB=A5=E6=9B=B4=E7=AE=80=E6=B4=81=E7=9A=84?= =?UTF-8?q?debug=E6=89=A7=E8=A1=8C=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20~=E4=B8=BApadavan=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=90=8E=E8=87=AA=E5=8A=A8=E4=BF=9D=E5=AD=98mtd=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=20~=E4=BC=98=E5=8C=96singbox=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=96=87=E4=BB=B6=E8=A6=86=E5=86=99=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E5=AF=B9=E5=90=84=E7=A7=8D=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84=E6=99=AE=E9=80=82?= =?UTF-8?q?=E6=80=A7=20~=E5=BD=93=E8=87=AA=E5=8A=A8=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E5=90=8C=E6=AD=A5ntp=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=B8=8D=E5=86=8D=E5=90=AF=E5=8A=A8singbox?= =?UTF-8?q?=E5=86=85=E7=BD=AE=E7=9A=84ntp=E6=A8=A1=E5=9D=97=20~singbox?= =?UTF-8?q?=E5=86=85=E7=BD=AEntp=E6=A8=A1=E5=9D=97=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E4=BA=86=E6=8C=87=E5=AE=9A=E5=87=BA=E5=8F=A3=E4=BB=A5=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=99=AE=E9=80=82=E6=80=A7=EF=BC=8C=E4=BD=86=E6=95=88?= =?UTF-8?q?=E6=9E=9C=E6=9C=89=E5=BE=85=E8=A7=82=E5=AF=9F=20~=E9=80=82?= =?UTF-8?q?=E9=85=8Dsingbox1.7.8=E7=89=88=E6=9C=AC=E7=9A=84mix=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=20~=E4=BF=AE=E5=A4=8D=E5=90=84=E7=A7=8D=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=89=BE=E4=B8=8D=E5=88=B0=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E6=88=96=E8=80=85=E5=86=85=E6=A0=B8=E4=B8=8B=E8=BD=BD=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98=20~=E4=BF=AE=E5=A4=8D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E9=BB=98=E8=AE=A4dns=E6=97=B6singbox=E5=86=85?= =?UTF-8?q?=E6=A0=B8=E6=8F=90=E7=A4=BAdns=E5=87=BA=E9=94=99=E7=9A=84bug=20?= =?UTF-8?q?~=E4=BF=AE=E5=A4=8Dsed=20-e=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... => singbox-linux-mipsle-hardfloat.tar.gz} | Bin ... => singbox-linux-mipsle-softfloat.tar.gz} | Bin ... => singbox-linux-mipsle-hardfloat.tar.gz} | Bin ... => singbox-linux-mipsle-softfloat.tar.gz} | Bin scripts/getdate.sh | 83 ++++++++------ scripts/menu.sh | 21 ++++ scripts/start.sh | 102 +++++++++--------- scripts/task.sh | 2 +- 8 files changed, 120 insertions(+), 88 deletions(-) rename bin/singbox/{singbox-linux-mipsel-hardfloat.tar.gz => singbox-linux-mipsle-hardfloat.tar.gz} (100%) rename bin/singbox/{singbox-linux-mipsel-softfloat.tar.gz => singbox-linux-mipsle-softfloat.tar.gz} (100%) rename bin/singboxp/{singbox-linux-mipsel-hardfloat.tar.gz => singbox-linux-mipsle-hardfloat.tar.gz} (100%) rename bin/singboxp/{singbox-linux-mipsel-softfloat.tar.gz => singbox-linux-mipsle-softfloat.tar.gz} (100%) diff --git a/bin/singbox/singbox-linux-mipsel-hardfloat.tar.gz b/bin/singbox/singbox-linux-mipsle-hardfloat.tar.gz similarity index 100% rename from bin/singbox/singbox-linux-mipsel-hardfloat.tar.gz rename to bin/singbox/singbox-linux-mipsle-hardfloat.tar.gz diff --git a/bin/singbox/singbox-linux-mipsel-softfloat.tar.gz b/bin/singbox/singbox-linux-mipsle-softfloat.tar.gz similarity index 100% rename from bin/singbox/singbox-linux-mipsel-softfloat.tar.gz rename to bin/singbox/singbox-linux-mipsle-softfloat.tar.gz diff --git a/bin/singboxp/singbox-linux-mipsel-hardfloat.tar.gz b/bin/singboxp/singbox-linux-mipsle-hardfloat.tar.gz similarity index 100% rename from bin/singboxp/singbox-linux-mipsel-hardfloat.tar.gz rename to bin/singboxp/singbox-linux-mipsle-hardfloat.tar.gz diff --git a/bin/singboxp/singbox-linux-mipsel-softfloat.tar.gz b/bin/singboxp/singbox-linux-mipsle-softfloat.tar.gz similarity index 100% rename from bin/singboxp/singbox-linux-mipsel-softfloat.tar.gz rename to bin/singboxp/singbox-linux-mipsle-softfloat.tar.gz diff --git a/scripts/getdate.sh b/scripts/getdate.sh index 9bdc3dd..683d91e 100644 --- a/scripts/getdate.sh +++ b/scripts/getdate.sh @@ -903,7 +903,7 @@ getcore(){ #下载内核文件 mkdir -p ${TMPDIR}/core_tmp tar -zxf "${TMPDIR}/core_new.tar.gz" -C ${TMPDIR}/core_tmp/ &>/dev/null || tar -zxf "${TMPDIR}/core_new.tar.gz" --no-same-owner -C ${TMPDIR}/core_tmp/ for file in $(find ${TMPDIR}/core_tmp 2>/dev/null);do - [ -s $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new + [ -f $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new done rm -rf ${TMPDIR}/core_tmp } @@ -942,41 +942,46 @@ setcustcore(){ #自定义内核 #通过githubapi获取内核信息 echo -e "\033[32m正在获取内核文件链接!\033[0m" ${CRASHDIR}/start.sh webget ${TMPDIR}/github_api https://api.github.com/repos/${project}/releases/${api_url} - release_tag=$(cat ${TMPDIR}/github_api | grep '"tag_name":' | awk -F '"' '{print $4}') - release_date=$(cat ${TMPDIR}/github_api | grep '"published_at":' | awk -F '"' '{print $4}') - [ -n "$(echo $cpucore | grep mips)" ] && cpu_type=mips || cpu_type=$cpucore - cat ${TMPDIR}/github_api | grep "browser_download_url" | grep -oE "https://github.com/${project}/releases/download.*linux.*${cpu_type}.*\.gz\"$" | sed 's/"//' > ${TMPDIR}/core.list - rm -rf ${TMPDIR}/github_api - # - if [ -f ${TMPDIR}/core.list ];then - echo ----------------------------------------------- - echo -e "内核版本:\033[36m$release_tag\033[0m" - echo -e "发布时间:\033[32m$release_date\033[0m" - echo ----------------------------------------------- - echo -e "\033[33m请确认内核信息并选择:\033[0m" - cat ${TMPDIR}/core.list | grep -oE "$release_tag.*" | sed 's|.*/||' | awk '{print " "NR" "$1}' - echo -e " 0 返回上级菜单" - echo ----------------------------------------------- - read -p "请输入对应数字 > " num - case "$num" in - 0) - setcustcore - ;; - [1-99]) - if [ "$num" -le "$(wc -l < ${TMPDIR}/core.list)" ];then - custcorelink=$(sed -n "$num"p ${TMPDIR}/core.list) - getcore - else + if [ "$?" = 0 ];then + release_tag=$(cat ${TMPDIR}/github_api | grep '"tag_name":' | awk -F '"' '{print $4}') + release_date=$(cat ${TMPDIR}/github_api | grep '"published_at":' | awk -F '"' '{print $4}') + [ -n "$(echo $cpucore | grep mips)" ] && cpu_type=mips || cpu_type=$cpucore + cat ${TMPDIR}/github_api | grep "browser_download_url" | grep -oE "https://github.com/${project}/releases/download.*linux.*${cpu_type}.*\.gz\"$" | sed 's/"//' > ${TMPDIR}/core.list + rm -rf ${TMPDIR}/github_api + # + if [ -s ${TMPDIR}/core.list ];then + echo ----------------------------------------------- + echo -e "内核版本:\033[36m$release_tag\033[0m" + echo -e "发布时间:\033[32m$release_date\033[0m" + echo ----------------------------------------------- + echo -e "\033[33m请确认内核信息并选择:\033[0m" + cat ${TMPDIR}/core.list | grep -oE "$release_tag.*" | sed 's|.*/||' | awk '{print " "NR" "$1}' + echo -e " 0 返回上级菜单" + echo ----------------------------------------------- + read -p "请输入对应数字 > " num + case "$num" in + 0) + setcustcore + ;; + [1-99]) + if [ "$num" -le "$(wc -l < ${TMPDIR}/core.list)" ];then + custcorelink=$(sed -n "$num"p ${TMPDIR}/core.list) + getcore + else + errornum + fi + ;; + *) errornum - fi - ;; - *) - errornum - ;; - esac + ;; + esac + else + echo -e "\033[31m找不到可用内核,可能是作者没有编译相关CPU架构版本的内核文件!\033[0m" + sleep 1 + fi else echo -e "\033[31m查找失败,请尽量在服务启动后再使用本功能!\033[0m" - sleep 1 + sleep 1 fi rm -rf ${TMPDIR}/core.list } @@ -1960,7 +1965,9 @@ debug(){ echo -e " 3 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[31merror\033[0m" echo -e " 4 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[32minfo\033[0m" echo -e " 5 后台运行完整启动流程,并配置防火墙劫持,日志等级:\033[33mdebug\033[0m" - [ "$crashcore" = singbox -o "$crashcore" = singboxp ] && echo -e " 6 将\033[32m$config_tmp\033[0m下json文件合并为$TMPDIR/debug.json" + echo ----------------------------------------------- + echo -e " 8 后台运行完整启动流程,输出执行错误并查找上下文,之后关闭进程" + [ -s $TMPDIR/jsons/inbounds.json ] && echo -e " 9 将\033[32m$config_tmp\033[0m下json文件合并为$TMPDIR/debug.json" echo ----------------------------------------------- echo " 0 返回上级目录!" read -p "请输入对应数字 > " num @@ -1968,6 +1975,7 @@ debug(){ 0) ;; 1) $CRASHDIR/start.sh stop + $CRASHDIR/start.sh bfstart if [ "$crashcore" = singbox -o "$crashcore" = singboxp ] ;then $TMPDIR/CrashCore run -D $BINDIR -C $TMPDIR/jsons & { sleep 4 ; kill $! &>/dev/null & } @@ -1980,6 +1988,7 @@ debug(){ ;; 2) $CRASHDIR/start.sh stop + $CRASHDIR/start.sh bfstart $COMMAND echo ----------------------------------------------- exit @@ -1996,7 +2005,11 @@ debug(){ $CRASHDIR/start.sh debug debug main_menu ;; - 6) + 8) + $0 -d + main_menu + ;; + 9) $TMPDIR/CrashCore merge $TMPDIR/debug.json -C $TMPDIR/jsons && echo -e "\033[32m合并成功!\033[0m" main_menu ;; diff --git a/scripts/menu.sh b/scripts/menu.sh index 808a28b..5670262 100644 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -1897,6 +1897,7 @@ case "$1" in echo " -h 帮助列表" echo " -u 卸载脚本" echo " -i 初始化脚本" + echo " -d 测试运行" echo ----------------------------------------- echo " crash -s start 启动服务" echo " crash -s stop 停止服务" @@ -1921,6 +1922,26 @@ case "$1" in shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash $shtype -x ${CRASHDIR}/start.sh $2 $3 $4 $5 $6 ;; + -d) + shtype=sh && [ -n "$(ls -l /bin/sh|grep -o dash)" ] && shtype=bash + echo -e "正在测试运行!如发现错误请截图后前往\033[32;4mt.me/ShellClash\033[0m咨询" + $shtype ${CRASHDIR}/start.sh debug >/dev/null 2>${TMPDIR}/sh_bug + $shtype -x ${CRASHDIR}/start.sh debug >/dev/null 2>${TMPDIR}/debug_sh.log + echo ----------------------------------------- + if [ -s ${TMPDIR}/sh_bug ];then + while read line ;do + echo -e "发现错误:\033[33;4m$line\033[0m" + grep -A 1 -B 3 "$line" ${TMPDIR}/debug_sh.log + echo ----------------------------------------- + done < ${TMPDIR}/sh_bug + rm -rf ${TMPDIR}/sh_bug + echo -e "\033[32m测试完成!\033[0m完整执行记录请查看:\033[36m${TMPDIR}/debug_sh.log\033[0m" + else + echo -e "\033[32m测试完成!没有发现问题~\033[0m" + rm -rf ${TMPDIR}/debug_sh.log + fi + ${CRASHDIR}/start.sh stop + ;; -u) uninstall ;; diff --git a/scripts/start.sh b/scripts/start.sh index 2dee180..0b179b7 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -52,7 +52,7 @@ ckcmd(){ #检查命令是否存在 command -v sh &>/dev/null && command -v $1 &>/dev/null || type $1 &>/dev/null } ckgeo(){ #查找及下载Geo数据文件 - [ -n "$(find --help 2>&1|grep size)" ] && find_para=' -size +20' #find命令兼容 + [ -n "$(find --help 2>&1|grep -o size)" ] && find_para=' -size +20' #find命令兼容 [ -z "$(find ${BINDIR}/${1} $find_para 2>/dev/null)" ] && { if [ -n "$(find ${CRASHDIR}/${1} $find_para 2>/dev/null)" ];then mv ${CRASHDIR}/${1} ${BINDIR}/${1} #小闪存模式移动文件 @@ -351,7 +351,6 @@ modify_yaml(){ #修饰clash配置文件 } #dns配置 [ -z "$(cat ${CRASHDIR}/yamls/user.yaml 2>/dev/null | grep '^dns:')" ] && { - [ "$crashcore" = 'meta' ] && dns_default_meta='- https://223.5.5.5/dns-query' cat > ${TMPDIR}/dns.yaml < ${TMPDIR}/jsons/add_hosts.json < ${TMPDIR}/jsons/add_rule_set.json < ${TMPDIR}/jsons/add_rule_set.json < ${TMPDIR}/jsons/dns.json < ${TMPDIR}/jsons/ntp.json < ${TMPDIR}/jsons/ntp.json <> ${TMPDIR}/jsons/outbounds.json [ "$crashcore" = "singboxp" ] && { echo '{' > ${TMPDIR}/jsons/outbound_providers.json - cat ${TMPDIR}/format.json | sed -n '/"outbound_providers":/,/^ "[a-z]/p}' | sed '$d' >> ${TMPDIR}/jsons/outbound_providers.json + cat ${TMPDIR}/format.json | sed -n '/"outbound_providers":/,/^ "[a-z]/p' | sed '$d' >> ${TMPDIR}/jsons/outbound_providers.json } - cat ${TMPDIR}/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p}' | sed '$d' >> ${TMPDIR}/jsons/route.json + cat ${TMPDIR}/format.json | sed -n '/"route":/,/^\( "[a-z]\|}\)/p' | sed '$d' >> ${TMPDIR}/jsons/route.json #清理route.json中的process_name规则以及"auto_detect_interface" sed -i '/"process_name": \[/,/],$/d' ${TMPDIR}/jsons/route.json sed -i '/"process_name": "[^"]*",/d' ${TMPDIR}/jsons/route.json @@ -822,7 +818,7 @@ cn_ip_route(){ #CN-IP绕过 echo "create cn_ip hash:net family inet hashsize 10240 maxelem 10240" > ${TMPDIR}/cn_$USER.ipset awk '!/^$/&&!/^#/{printf("add cn_ip %s'" "'\n",$0)}' ${BINDIR}/cn_ip.txt >> ${TMPDIR}/cn_$USER.ipset ipset -! flush cn_ip 2>/dev/null - ipset -! restore < ${TMPDIR}/cn_$USER.ipset + ipset -! restore < ${TMPDIR}/cn_$USER.ipset 2>/dev/null rm -rf cn_$USER.ipset } } @@ -834,7 +830,7 @@ cn_ipv6_route(){ #CN-IPV6绕过 echo "create cn_ip6 hash:net family inet6 hashsize 4096 maxelem 4096" > ${TMPDIR}/cn6_$USER.ipset awk '!/^$/&&!/^#/{printf("add cn_ip6 %s'" "'\n",$0)}' ${BINDIR}/cn_ipv6.txt >> ${TMPDIR}/cn6_$USER.ipset ipset -! flush cn_ip6 2>/dev/null - ipset -! restore < ${TMPDIR}/cn6_$USER.ipset + ipset -! restore < ${TMPDIR}/cn6_$USER.ipset 2>/dev/null rm -rf cn6_$USER.ipset } } @@ -1482,12 +1478,11 @@ EOF } core_check(){ #检查及下载内核文件 - if [ ! -f ${TMPDIR}/CrashCore ];then - if [ -f ${BINDIR}/CrashCore ];then - ln -sf ${BINDIR}/CrashCore ${TMPDIR}/CrashCore - elif [ -f ${BINDIR}/CrashCore.tar.gz ];then - tar -zxvf "${BINDIR}/CrashCore.tar.gz" -C ${TMPDIR}/ &>/dev/null || tar -zxvf "${BINDIR}/CrashCore.tar.gz" --no-same-owner -C ${TMPDIR}/ - else + [ -n "$(find --help 2>&1|grep -o size)" ] && find_para=' -size +2000' #find命令兼容 + [ -z "$(find ${TMPDIR}/CrashCore $find_para 2>/dev/null)" ] && [ -n "$(find ${BINDIR}/CrashCore $find_para 2>/dev/null)" ] && mv ${BINDIR}/CrashCore ${TMPDIR}/CrashCore + [ -z "$(find ${TMPDIR}/CrashCore $find_para 2>/dev/null)" ] && [ -n "$(find ${BINDIR}/CrashCore.tar.gz $find_para 2>/dev/null)" ] && \ + tar -zxf "${BINDIR}/CrashCore.tar.gz" -C ${TMPDIR}/ &>/dev/null || tar -zxf "${BINDIR}/CrashCore.tar.gz" --no-same-owner -C ${TMPDIR}/ + [ -z "$(find ${TMPDIR}/CrashCore $find_para 2>/dev/null)" ] && { logger "未找到【$crashcore】核心,正在下载!" 33 [ -z "$cpucore" ] && source ${CRASHDIR}/getdate.sh && getcpucore [ -z "$cpucore" ] && logger 找不到设备的CPU信息,请手动指定处理器架构类型! 31 && exit 1 @@ -1495,8 +1490,8 @@ core_check(){ #校验内核 mkdir -p ${TMPDIR}/core_tmp tar -zxvf "${TMPDIR}/CrashCore.tar.gz" -C ${TMPDIR}/core_tmp/ &>/dev/null || tar -zxvf "${TMPDIR}/CrashCore.tar.gz" --no-same-owner -C ${TMPDIR}/core_tmp/ - for file in $(find ${TMPDIR}/core_tmp 2>/dev/null);do - [ -s $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new + for file in $(find ${TMPDIR}/core_tmp $find_para 2>/dev/null);do + [ -f $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|pre)')" ] && mv -f $file ${TMPDIR}/core_new done rm -rf ${TMPDIR}/core_tmp chmod +x ${TMPDIR}/core_new @@ -1518,8 +1513,7 @@ core_check(){ setconfig crashcore $crashcore setconfig core_v $core_v fi - fi - fi + } [ ! -x ${TMPDIR}/CrashCore ] && chmod +x ${TMPDIR}/CrashCore 2>/dev/null #自动授权 return 0 } @@ -1688,6 +1682,7 @@ afstart(){ #启动后 mark_time #标记启动时间 [ -s ${CRASHDIR}/configs/web_save -o -s ${CRASHDIR}/configs/web_configs ] && web_restore &>/dev/null & #后台还原面板配置 { sleep 5;logger ShellCrash服务已启动!;} & #推送日志 + ckcmd mtd_storage.sh && mtd_storage.sh save &>/dev/null & #Padavan保存/etc/storage #加载定时任务 [ -s ${CRASHDIR}/task/cron ] && croncmd ${CRASHDIR}/task/cron [ -s ${CRASHDIR}/task/running ] && { @@ -1819,16 +1814,19 @@ debug) getconfig stop_firewall >/dev/null #清理路由策略 bfstart - [ -n "$2" ] && { + if [ -n "$2" ];then if [ "$crashcore" = singbox -o "$crashcore" = singboxp ];then - sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" ${TMPDIR}/config.json + sed -i "s/\"level\": \"info\"/\"level\": \"$2\"/" ${TMPDIR}/jsons/log.json 2>/dev/null else sed -i "s/log-level: info/log-level: $2/" ${TMPDIR}/config.yaml fi - } - $COMMAND &>${TMPDIR}/debug.log & + $COMMAND >${TMPDIR}/debug.log 2>&1 & + sleep 2 + logger "已运行debug模式!如需停止,请使用重启/停止服务功能!" 33 + else + $COMMAND >/dev/null 2>&1 & + fi afstart - logger "已运行debug模式!如需停止,请正常重启一次服务!" 33 ;; init) profile=/etc/profile diff --git a/scripts/task.sh b/scripts/task.sh index aa5ab41..9ecf892 100644 --- a/scripts/task.sh +++ b/scripts/task.sh @@ -51,7 +51,7 @@ update_core(){ #自动更新内核 mkdir -p ${TMPDIR}/core_new tar -zxf "${TMPDIR}/core_new.tar.gz" -C ${TMPDIR}/core_new/ &>/dev/null || tar -zxf "${TMPDIR}/core_new.tar.gz" --no-same-owner -C ${TMPDIR}/core_new/ for file in $(find ${TMPDIR}/core_tmp 2>/dev/null);do - [ -s $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new + [ -f $file ] && [ -n "$(echo $file | sed 's#.*/##' | grep -iE '(CrashCore|sing|meta|mihomo|clash|premium)')" ] && mv -f $file ${TMPDIR}/core_new done rm -rf ${TMPDIR}/core_new }