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
0
votes
2 answers

How to reset tput text decoration and color

I have a bash script and I want to be able to highlight critical errors when they occur. To that end I wrote the simple function below error() { # set the text decoration tput -S <&2 exit…
richbai90
  • 4,994
  • 4
  • 50
  • 85
0
votes
0 answers

Clear wrapped lines with curses

When I run the following code in bash, in a terminal that's not too wide (currently my terminal is 97 columns wide), I don't see the expected behavior # foo.sh tput sc # save cursor for i in $(seq 10); do printf "%s"…
Robert T. McGibbon
  • 5,075
  • 3
  • 37
  • 45
0
votes
1 answer

How to delete everything after the cursor?

I want to delete everything after the cursor; not just the current line, but every remaining characters after the current position. For example of tput sc; ll; tput rc: root@test:~# tput sc; ll; tput rc root@test:~#…
Chris
  • 29,127
  • 3
  • 28
  • 51
0
votes
2 answers

$(shell tput sgr0) in Makefile cause "syntax error near unexpected token `('"

I have a Makefile with tput color variables _OFF := $(shell tput sgr0) BG_RED := $(shell tput setab 1) $(info TERM1=${BG_RED}${TERM}${_OFF}_xxx) all: @echo TERM2=${BG_RED}${TERM}${_OFF}_xxx The second prompt will give out an error /bin/sh:…
Jinyu
  • 169
  • 2
  • 9
0
votes
1 answer

tput is very slow on MinTTY (Git Bash)

Git Bash is pretty sluggish overall (compare 1.082s of average runtime under WSL/Ubuntu vs 4.460s in MinTTY). I've narrowed down a whopping 1.479s to the following chunk of code: # Determine if this terminal supports colors if test -t 1; then …
Sean Allred
  • 3,558
  • 3
  • 32
  • 71
0
votes
1 answer

Python update multiple lines after print

How can I update multi lines in python after print them? Like this example: Something like tput ( https://linux.die.net/man/1/tput ) inside python. Thanks
Rui Martins
  • 3,337
  • 5
  • 35
  • 40
0
votes
0 answers

How to get logs of shell script in Bold letters

I have written a Bash script to sync all files from a local folder to s3 bucket. And all the logs are sent to email when the script is run through the cron job. The email output looks like this: -----------------------Started at: Wed 3 Mar 10:56:01…
0
votes
1 answer

How to clear read input when using tput rc?

$ cat test.sh #!/bin/bash sc=$(tput sc) rc=$(tput rc) printf "$sc%s\n" "Type word" read -r word printf "$rc%s\n" "Type word (again)" read -r word_confirmation $ ./test.sh Type word (again) test I would like test to be cleared.
sunknudsen
  • 6,356
  • 3
  • 39
  • 76
0
votes
0 answers

How to stop tput bel from flashing the screen at internals

I accidentally called tput bel on my Mac with iterm2 and now my terminal screen flashes at some interval. How to reverse the tput bel command?
0
votes
1 answer

SIGWINCH, bash, dash, tput, and terminfo

I'm a little confused about the interaction between tput and terminal sizes. It seems that the behavior of tput depends on the shell under which it is invoked, or perhaps the shell is responsible for changing terminal settings, or.... something. …
William Pursell
  • 204,365
  • 48
  • 270
  • 300
0
votes
1 answer

How to set a variable with color and left align with bash

How do I set a variable with color and left align with bash Example: red=$(tput setaf 1) green=$(tput setaf 2) normal=$(tput sgr0) if [ $process_state != "running" ]; then process_state=${red}$process_state${normal} else …
Ryan Harlich
  • 157
  • 1
  • 7
0
votes
2 answers

Get terminal contents

Is it possible to get a snapshot of the text contents of a Linux terminal? Both tput and terminfo support "cup" mode (e.g. tput smcup to start alternate buffer mode) which implies they must save the screen state somewhere. Is it possible to get…
hash-bang
  • 492
  • 1
  • 4
  • 9
0
votes
2 answers

How to make a text bold in shell script and send the output using SMTP

I want to make text bold and send that output using SMTP as mail. Mail configuration is done properly and i am getting mail. But i am getting a .bin file instead of the printed line. Please help me with this. This is my code to make the text…
Kaverappa KU
  • 87
  • 1
  • 7
0
votes
1 answer

barman + mark the failed/started backup with red color

With the following barman command we can see the backup status, while STARTED/FAILED status indicated that backup inst created successfully barman list-backup main-db-server Output: main-db-server 20170913T115706 - STARTED main-db-server…
King David
  • 500
  • 1
  • 7
  • 20
0
votes
0 answers

tput: terminal attributes: No such device or address

tput: terminal attributes: No such device or address in Enthought Canopy. I am trying import plotly.plotly as py import numpy as np data = [dict( visible = False, line=dict(color='00CED1', width=6), name = ' = '+str(step), …