View Full Version : Shell commands - printing text to terminal
castiglione
June 21st, 2012, 03:47 PM
I was just wondering if it were possible to print text to a specific screen location using shell commands?
I.e. Print "Test" at line 2, horizontal space 5, and things of that nature, overwriting pre-existing text if necessary?
Thanks in advance!
c
codemaniac
June 21st, 2012, 04:08 PM
I was just wondering if it were possible to print text to a specific screen location using shell commands?
I.e. Print "Test" at line 2, horizontal space 5, and things of that nature, overwriting pre-existing text if necessary?
Thanks in advance!
c
If you want to format your output in a terminal , there are many tools available like awk , perl or Bash-builtin commands like echo , printf .
The below command would print two newlines and 4 spaces prefixed with "Text" .
printf "\n\n%-4sText"
However not clear what exactly you are trying to achieve .
It would be helpful if you post your requirement clearly .
Habitual
June 21st, 2012, 09:04 PM
I was just wondering if it were possible to print text to a specific screen location using shell commands?...
It is!
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x405.html
tput is the command you are looking for. :)
Edit: Here's what it looks like (yellow is just highlighting, NOT in the code I posted!http://i771.photobucket.com/albums/xx360/E522260/Screenshot.png
Here's the code that generated the output:
http://susepaste.org/36118090
HTH further. :)
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.