简体   繁体   中英

Bash: “tput initc” doesn't seem to work

I'm working on a bash script in which I start off with some tput initc commands for specifying custom colours for use in the script. But when I run the script to test, it seems to just still be using Terminal.app 's default "Basic" theme colours. (I'm testing using a virtual machine running a fresh install of Mavericks.)

Here are the commands I'm using:

tput initc 0 300 300 300
tput initc 1 800 210 100
tput initc 2 650 760 380
tput initc 3 800 460 180
tput initc 4 350 530 670
tput initc 5 630 380 470
tput initc 6 470 710 760
tput initc 7 810 810 810
tput initc 8 570 570 570
tput initc 9 1000 280 200
tput initc 10 720 710 0
tput initc 11 1000 780 430
tput initc 12 530 760 1000
tput initc 13 820 820 1000
tput initc 14 440 760 830
tput initc 15 910 910 910

So to pick an example, this should set Yellow (3) to a kind of brownish colour, but when I then do a tput setaf 3 and echo some text (either on separate lines or including it within an echo using the $() syntax) it still just prints the same default yellow.

What am I doing wrong? I've found very little along the way of documentation on initc —I don't even see it listed in tput 's man page—so I'm not sure if I'm even using it correctly.

Thanks!

Terminal.app doesn't support the control sequences you're trying to use here. You'll need to use another terminal application (such as iTerm2 ), or use colors that are already available within the standard 256.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM