Closed yyingc closed 1 year ago
I think the problem is how to escape the double quote character in the sed
substitution.
Try this:
%busybox% wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest"|%busybox% grep -i "tag_name"|!busybox! sed -r "s/tag_name//gI;s/[\\":,]//g;s/[[:space:]]//g"|sort
Mixing cmd.exe and Unix shell syntax will, unfortunately, result in many problems like this.
I think the problem is how to escape the double quote character in the
sed
substitution.Try this:
%busybox% wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest"|%busybox% grep -i "tag_name"|!busybox! sed -r "s/tag_name//gI;s/[\\":,]//g;s/[[:space:]]//g"|sort
Mixing cmd.exe and Unix shell syntax will, unfortunately, result in many problems like this.
I found out that the problem is the double quotes, but I need to remove the double quotes, this can not be solved
s/[\\":,]//g
Sorry, try s/[\"":,]//g
instead.
Alternatively put the commands in a shell script file (called release
, for example):
#!/bin/sh
wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest" | \
grep -i "tag_name" | \
sed -r "s/tag_name//gI;s/[\":,]//g;s/[[:space:]]//g" | sort
and run it using %busybox% sh release
.
Sorry, try
s/[\"":,]//g
instead.Alternatively put the commands in a shell script file (called
release
, for example):#!/bin/sh wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest" | \ grep -i "tag_name" | \ sed -r "s/tag_name//gI;s/[\":,]//g;s/[[:space:]]//g" | sort
and run it using
%busybox% sh release
.
for /f "delims=" %%v in ('%busybox% wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest"^|%busybox% grep -i "tag_name"^|%busybox% sed -r "s/tag_name//gI;s/["":,]//g;s/[[:space:]]//g"') do (ECHO %%~v)
It worked, thank you very much for your patience.
How to use %busybox% pipe_progress
with wget command, I want to use progress bar
You just need to include %busybox% pipe_progress
in the pipeline. It passes any data through to the next command and displays a '.' every second.
C:\Users\rmy>%busybox% wget -q -O - ftp://ftp.frippery.org/iso/bigfile.iso | %busybox% pipe_progress | %busybox% cat >bigfile.iso
..............................
C:\Users\rmy>
You just need to include
%busybox% pipe_progress
in the pipeline. It passes any data through to the next command and displays a '.' every second.C:\Users\rmy>%busybox% wget -q -O - ftp://ftp.frippery.org/iso/bigfile.iso | %busybox% pipe_progress | %busybox% cat >bigfile.iso .............................. C:\Users\rmy>
Thank you. The problem has been resolved and we have successfully used it
BusyBox v1.37.0-FRP-4882-g6e0a6b7e5 (2023-02-15 22:00:25 GMT) (mingw64-gcc 12.2.1-5.fc37; mingw64-crt 10.0.0-3.fc37; glob)
I am using in batch The latest version tag I use to get the resource
%busybox% wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest"|%busybox% grep -i "tag_name"|!busybox! sed -r "s/tag_name//gI;s/[\":,]//g;s/[[:space:]]//g"|sort
Error message: sed: bad option in substitution expression%busybox% wget -q -O - "https://api.github.com/repos/fatedier/frp/releases/latest"|%busybox% grep -i "tag_name"|!busybox! sed -r "s/tag_name//gI;s/[\":,]//g;s/[[:space:]]//g" >test.txt
errorOr if you want to integrate the tr command