Jay Taylor's notes
back to listing indexHow to delete line with echo?
[web search]
I know that I could delete the last three chars with:
But how can I delete a full line? I mean I dont want to use:
...etc... to delete a long line.. |
|||||||||||||||
|
|||||||||||||||
You can use Example: both
and
will print:
If you want the characters deleted then you have to use the following workaround:
output:
Excerpt from
|
|||||||||||||||||||||
|
You're looking for terminal escapes. In particular, to clear from the cursor position to the beginning of the line:
Or everything on the line, regardless of cursor position:
And you can do all sorts of other neat tricks with terminal escapes too. |
|||||||||||||||||||||
|
If you want to clear the line, then I suggest you use a combination of the carriage return people are mentioning and terminfo.
This will write |
|||||||||
|
You explicitly ask for
|
|||||||||||||||
|
Your Answer
Not the answer you're looking for? Browse other questions tagged / bash / echo or ask your own question.
asked |
4 years ago |
viewed |
30335 times |
active |
Related
Hot Network Questions
- Is it possible to run a motherboard in distilled water?
- How many kinds of "weak charges" exist?
- How did planes measure their speed relative to the ground before GPS?
- How do I open a new buffer without opening it in a split?
- Mushrooms instead of tomatoes
- How to take a screenshot that includes a scrolling element within a web page in Firefox?
- Would an elf raised by dwarves still have elvish as a language?
- Synonym for a very insignificant product improvement
- Does grease reflex check fail reveal invisible target?
- Pattern recognition puzzle: 12651
- Arranging drinks with laid off coworkers in close-knit team
- Publishing without your supervisor
- What is the difference between a cafe and a diner?
- Is accessing a static out of scope undefined behavior?
- Why do Catholic laity cross themselves three times before the Gospel is read?
- How did the Mario Brothers discover/enter the Mushroom Kingdom?
- Why can't I remove the '.' directory?
- Difference between "command not found" and "no such file or directory"?
- A large part of my code has a major design flaw. Finish it off or fix it now?
- Whenever I install Iceweasel it installs Firefox instead
- Solar cells in series
- Are `==` and `!=` mutually dependent?
- What does the "Fi" in "Wi-Fi" mean?
- How likely is a war between the U.S. and China?
Technology | Life / Arts | Culture / Recreation | Science | Other | ||
---|---|---|---|---|---|---|
This site is not affiliated with Linus Torvalds or The Open Group in any way.