Hi I am running bash shell scripts on raspberry pi target using Buildroot environment and I am trying to enable colours in bash shell programming for output using tput command but in buildroot it seems to be not supported. Please suggest alternate option to enable colours. For example, I am writing following in the shell script echo "$(tput setaf 2) $(tput bold) $(tput smso) LINUX PERFORMANCE TEST $(tput rmso) $(tput sgr 0)" and in the target it says perf_test_1.sh: line 8: tput: command not found Please suggest.
Hi umamahesh, If this is still relevant, here is the solution. "tput" is part of the ncurses package. To enable it, go to: make menuconfig Target packages Libraries Text and terminal handling Enable "ncurses", then enable the "ncurses programs" entry that has just appeared. Help for the "ncurses programs" entry: BR2_PACKAGE_NCURSES_TARGET_PROGS: Include ncurses programs in target (clear, reset, tput, ...) Best regards, Tibor Stolz
Another solution is to program directly with escape sequences: echo -e '\E[32;1;7m LINUX PERFORMANCE TEST \E[0m' echo -ne '\E[32;1;7m' echo -n "LINUX PERFORMANCE TEST" echo -e '\E[0m' This will work on the Linux console and terminal emulators like xterm. See "help echo" and "man console_codes"-->"ECMA-48 Set Graphics Rendition" on your host Linux system. Best regards, Tibor Stolz