Malik Fassi
Malik Fassi

Reputation: 488

remove break line before prompt

How can I remove the new line before the prompt. I don't exactly know how to formulate the question, so here's an example.

I want to pass from

%> echo "hello world"
hello world
%>

to

%> echo "hello world"
hello world%>

I tried sed 's/\\n//' to subtitute the new line. Even with \\r and with tr. Maybe the cut fonction will be accurate ??

echo -n method I get

  %> echo -n "hello world"
  hello world%                     #note the new character % just appeared
  %>

Upvotes: 0

Views: 70

Answers (2)

Mariappan Subramanian
Mariappan Subramanian

Reputation: 10073

You can simply do this,

printf "hello world"

Upvotes: 0

shyam
shyam

Reputation: 9368

You can use the -n switch that will not add the eol

echo -n "hello world"

Upvotes: 2

Related Questions