grep の指し示すもの
opkg の grep はbusybox なので正規表現の取り扱いが微妙
root@OpenWrt:~# grep -v BusyBox v1.33.2 (2021-12-14 22:12:22 UTC) multi-call binary. root@OpenWrt:~# which grep /bin/grep root@OpenWrt:~# ls -l $(which grep) lrwxrwxrwx 1 root root 7 Dec 21 03:26 /bin/grep -> busybox
GNU Grep を使う。
opkg install grep
Grep をインストール。
root@OpenWrt:~# opkg find grep grep - 3.6-1 - The grep command searches one or more input files for lines containing a match to a specified pattern. By default, grep prints the matching lines.
grep をいれても GNU grep にならないので、調べたら。busybox を上書きするわけではなさそう。
bin/grep にインストールされているわけではなさそう。
root@OpenWrt:~# find / | grep grep /bin/egrep /bin/fgrep /bin/grep /usr/bin/pgrep /usr/bin/zipgrep /usr/lib/opkg/info/grep.control /usr/lib/opkg/info/grep.postinst /usr/lib/opkg/info/grep.prerm /usr/lib/opkg/info/grep.list /usr/lib/opkg/info/procps-ng-pgrep.control /usr/lib/opkg/info/procps-ng-pgrep.postinst /usr/lib/opkg/info/procps-ng-pgrep.prerm /usr/lib/opkg/info/procps-ng-pgrep.list /usr/lib/git-core/git-bugreport /usr/lib/git-core/git-grep /usr/libexec/egrep-gnu /usr/libexec/fgrep-gnu /usr/libexec/grep-gnu /usr/libexec/pgrep-procps-ng
/usr/libexec/grep-gnu
が私達がよく知る GNU Grep です。
root@OpenWrt:~# /usr/libexec/grep-gnu -v Usage: grep-gnu [OPTION]... PATTERNS [FILE]... Try 'grep-gnu --help' for more information.
opkg で確認してみる。
opkg files でインストールするファイル一覧が出せる。 これで答え合わせして調べてみると、/usr/libexec にインストールされることがわかる。
root@OpenWrt:~# opkg files grep Package grep (3.6-1) is installed on root and has the following files: /usr/libexec/egrep-gnu /usr/libexec/fgrep-gnu /usr/libexec/grep-gnu
2022-03-09
opkg files でfile list を出す方法について追記。