[Termux] Remove warnings on startup
I am using ble.sh on my Android phone using termux, and everything works just fine.
How can I disable these warnings?
Also, thanks for building this awesome tool, I use it everywhere!
ble.sh: insane environment: $USER is empty. ble.sh: modified USER=u0 a516
ble.sh: The locale 'en_US.UTF-8' (LC_CTYPE) seems broken. Please check that the locale exists in the system.
ble.sh: insane environment: $USER is empty. ble.sh: modified USER=u0 a516
This means that the variable USER is not set in your environment, which is the problem of the environment. For this error, you can set the user name in ~/.bashrc (before sourcing ble.sh):
# bashrc
: "${USER:=$(id -un)}"
export USER
ble.sh: The locale 'en_US.UTF-8' (LC_CTYPE) seems broken. Please check that the locale exists in the system.
This is an issue of the Termux environment, where the behavior of en_US.UTF-8 provided by the Termux environment is broken. This is already reported at #507. The situaion is described in https://github.com/termux/termux-packages/discussions/23010#discussioncomment-12487582 in detail. If you want to avoid this problem and do not use UTF-8, please set LANG=C (before sourcing ble.sh):
# bashrc
LANG=C
edit: This doesn't solve the underlying issue with the Termux locales, but it should at least suppress the error (by skipping the check).
Discussions are ongoing.
- https://github.com/akinomyoga/ble.sh/issues/507
- https://github.com/termux/termux-packages/discussions/23010
- https://github.com/termux/termux-packages/issues/25149
In commit ea1e547bc0ffd39e62a2011b4b4530024d6c91da, I updated the warning message for the Termux environment to make it more precise. I also added a link to the upstream discussion.