Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8156911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:06:10+00:00 2026-06-06T17:06:10+00:00

My bash-script looks as following: echo "Description:" while [ $finishInput -eq 0 ]; do

  • 0

My bash-script looks as following:

echo "Description:"
while [ $finishInput -eq 0 ]; do
  read tmp
  desc="$desc"$'\n'"$tmp"
  if [ -z "$tmp" ]; then
    finishInput="1"
  fi
done
echo -n "Maintainer:"
read maintainer

It reads to the desc var until a empty line is passed. After that, i want to read in other stuff.

When executing my current script it looks like this:

Description:
Line 1
Line 2

Maintainer:

I would like to overwrite the last empty line with the "Maintainer:".

I searched for a solution but only found suggestions which were like

echo -n "Old line"
echo -e "\r new line"

which stays on the line and overwrites it. This is not possible in my case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:06:11+00:00Added an answer on June 6, 2026 at 5:06 pm

    In your example you delete the text at the same line. When you want to return to the previous line use \e[1A, and to clear that line, use \e[K:

    echo 'Old line'
    echo -e '\e[1A\e[Knew line'
    

    When you want to go N lines up, use \e[<N>A

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that looks like this #!/bin/bash function something() { echo hello
I have a bash script that looks like the following: #!/bin/bash FILES=public_html/*.php # */
I'm following the tutorial here: http://bash.cyberciti.biz/guide/If..else..fi#Number_Testing_Script My script looks like: lines=`wc -l $var/customize/script.php` if
I have a bash script that looks like this: #!/bin/sh previousRelease=`git describe --tags --match
I am trying to write a bash script that looks at two files with
Linux bash script: function Print() { echo $1 } Print OK This script runs
Linux bash script: #!/bin/bash function Print() { echo $1 } var=* Print $var Execution
In Bash script, what is the difference between the following snippets? 1) Using single
I bumped into the following problem: I'm writing a Linux bash script which does
As an example consider the following bash script. There are two loops, the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.