1

Probably a rooky question, but I have seen that the "rankmirrors" command can use the stdin input. But when I run the following command (which retrieve all URL in use in the "mirrorslist" file to the "rankmirrors"), I get an error:

$ rg -e "^Server" /etc/pacman.d/mirrorlist | rg -oe "https.*"  | rankmirrors -t
Must specify URL, mirrorfile, or stdin.

There is another way to use the previous command stdout as current stdin of the command ?

Apitronix
  • 113
  • 3

1 Answers1

1

A common convention for telling "read from stdin" for programs that normally expect a filename or URL specified on the command line is to specify just a single minus sign in place of the filename/URL. The rankmirrors command supports this convention, so:

rg -e "^Server" /etc/pacman.d/mirrorlist | rg -oe "https.*"  | rankmirrors -t -

Reference: https://wiki.archlinux.org/title/mirrors#Fetching_and_ranking_a_live_mirror_list

telcoM
  • 87,318
  • 3
  • 112
  • 232
  • Thank you ! It seems this little modification works. But it seems that the "rankmirrors" tool don't print anything, I'm digging... But you have answered to my first question ! :) – Apitronix Mar 19 '22 at 12:59