Given the following file on an Android phone with a Termux installation:
$ cat file.txt
line1
line2
line3
美元
grep 美元 file.txt returns nothing, while grep line file.txt works as expected. Quoting the Chinese characters doesn't seem to have an effect.
On my Arch Linux system, by comparison, these commands all work as expected.
For reference, in Termux, here are the relevant software versions:
GNU bash, version 5.0.16(1)-release (aarch64-unknown-linux-android)
grep (GNU grep) 3.4
And on my Arch Linux laptop:
GNU bash, version 5.0.16(1)-release (x86_64-pc-linux-gnu)
grep (GNU grep) 3.4
I looked on Android Stack Exchange for answers, but didn't find anything.
I tried busybox grep 美元 file.txt, and this worked as expected. My question is, why doesn't just grep ... work?
Edit:
The output of ldd on my phone:
~ $ ldd $(which grep)
libandroid-support.so
libpcre.so
libc.so
~ $ ldd $(which busybox)
libm.so
libc.so
LC_ALL=en_US.UTF-8 grep 美元 file.txtwork? If yes, how aboutLC_ALL=en_US.UTF-8 grep .元 file.txt? - user313992ldd grep. Or if there's noldd, tryLD_TRACE_LOADED_OBJECTS=1 grep . /dev/null. And if even that doesn't work, tryLD_DEBUG=1 grep & logcat | grep linker.*linking. If you get something, edit it into the Q. - user313992ldd grepreturned "file not found" so I usedwhichinstead. - kGdmioT