Questions tagged [tput]

Utility to make the values of terminal-dependent capabilities and information available to the shell. Often used to set shell color.

72 questions
1
vote
1 answer

How do programs like man, screen, and vim create temporary overlays?

Several *NIX commands, such as screen, man, vim and others, create a temporary canvas/screen/overlay in a shell environment. When such programs execute, they cover or hide whatever content was displayed in the terminal before — almost like a "full…
jvriesem
  • 1,859
  • 3
  • 18
  • 40
1
vote
2 answers

Bash function to draw array of coordinates

With a given array of underscore separated coordinates (like so: 5_2 4_5 1_3), I need a fast bash function to draw a block character at those locations on the terminal screen. Right now I have this: function draw() { clear for i in $(echo…
k-a-v
  • 326
  • 5
  • 22
1
vote
2 answers

Strip leading AND trailing ansi/tput codes from string

The application here is "sanitizing" strings for inclusion in a log file. For the sake of argument, let's assume that 1) colorizing the string at runtime is proper; and 2) I need leading and trailing spaces on screen but excess whitespace removed…
LCB
  • 91
  • 1
  • 11
1
vote
1 answer

Display a splash screen or dialog box from bash script while script is running

I want to create a splash screen/ active dialog box while my script is running in the background to inform the user what is happening. My script file starts up different components of a local application and has a bunch of words & stuff that the…
1
vote
1 answer

Using column command on tput result over bash

I have a variable "x" , which contains two columns and two row. I wanted to print "hi" in RED color, so I took help of tput ,which printed the result in red. But I also needed to print the columns in proper alignment for that I used column -t but it…
monk
  • 1,953
  • 3
  • 21
  • 41
1
vote
2 answers

What's the difference between cursor_up (cuu1) and key_up (kcuu1) in terminfo(5)?

In terminfo(5): Variable String Capname TCap Code Description cursor_up cuu1 up up one line key_up kcuu1 ku up-arrow key I tried with tput and they produce the same output: $ tput cuu1 | hd -C 00000000 1b 5b 41 …
pynexj
  • 19,215
  • 5
  • 38
  • 56
1
vote
1 answer

Stop echo and consume all user input in Bash

TARGET Until some sub-task in script completes its job: stop echo; disable cursor; consume all user input; do not block interrupts (Ctrl+C, etc.). WHAT HAVE DONE For now, using this answer, I create few functions for that, here they are: function…
urusai_na
  • 393
  • 4
  • 11
1
vote
2 answers

Buildroot: Ncurses includes tput?

I have a startup sh script that plays an "animation" of text, using tput to manipulate / delete lines on the terminal. Unfortunately it does not seem that tput is present on my system, I have included the ncurses library, which apparently also…
Rampartisan
  • 427
  • 6
  • 19
1
vote
1 answer

tput: "No value for $TERM and no -T specified" when command run over ssh

I am running shell script from master node in the cluster on all other nodes as, ssh root@"$node_name" 'bash -s' < ./script.sh script.sh contains the following line which is used for formatting which adds horizontal line according to the size of…
lsbmsb
  • 39
  • 1
  • 9
1
vote
0 answers

tput doesn't set color in the terminal

I wish to colorize my terminal while using interactive shell, namely the command prompt. I managed to do this using escape sequences: PS1="\e[93m prompt> \e[0m" I want to use tput instead of escape sequences. Like that: PS1="$(tput setaf 1) prompt>…
1234ru
  • 692
  • 8
  • 16
1
vote
1 answer

run a remote bash script with arguments with ssh

I am unable to run a remote shell script located on "admin" server with arguments. ssh koliwada@admin "~/bin/addautomaps $groupentry $homeentry $ticket" "groupentry" and "homeentry" are as follows user1:*:52940:OWNER-user1 user1 …
anudeep
  • 415
  • 6
  • 19
1
vote
2 answers

Select random value from array before every prompt in bash

I'm trying to make a custom prompt that selects one random value from the following lists: color=(1 2 3 4 5 6) much=(such very much many so) wow=(wow hacker terminal geek confusion) then does this before every prompt. tput setaf $rcolor echo -n…
clapp
  • 195
  • 3
1
vote
1 answer

Any way to make terminal control sequences portable?

I'm currently in the process of planning out a custom Vim-like editor. It's going to be written in C and I want it to be as portable as possible between as many types of systems as possible. I'm aware of curses (ncurses, I suppose), the tput…
Bitani
  • 73
  • 1
  • 7
0
votes
1 answer

How can I print characters to screen like vim on linux?

I'm writing a program that needs to modify the terminal screen buffer without using printf or stdout. On win32 I did that by using CreateConsoleScreenBuffer() and SetConsoleActiveScreenBuffer() then writing to the console screen buffer using…
Phillip
  • 135
  • 6
0
votes
1 answer

Can I stop total line clearing when backspacing on a read in Bash?

I have a Bash script which asks a user to input text. It displays the question and answer within a line-drawing character menu 'panel', like so: #!/bin/bash function menu_display { clear tput cup 0 0; tput sgr0; echo "…