How to place the output of two different echo statements on one line

Hello there,

I wrote a shell script to modify the code for some of our clients in our client database. Before starting the data modification the program performs a few checks.

When a check is being performed, it should be shown on the screen of the user running the program, the result of the check should appear a few seconds later on the screen, on the same line.

for example.

.....
.....
.....
echo "Start check 1 for client" $1 ".........."

if [ check 1 = true ]
echo "OK"
else
echo "NOT OK"
exit
fi
.....
.....
.....

When I run my scripts, the result on the screen will be

$ data_modif.sh
Start check 1 for client A ..........
OK
$

What I would like it to be is
$ data_modif.sh
Start check 1 for client A..........OK
$

I have been trying for a few HOURS now to get the description of the check and the result of the check on the same line, but it seems hopeless.

Maybe someone can help me.

Readup on the tput command.

man tput

With it you can move the cursor to a specific line on screen, and then "echo" from that point.

Failing that, I would recommend writing the script in another language which would allow more flexability in its output - Perl, for example.

This is shell dependent. Most shells have echo built in, and you thus need to check the man page for the shell.

(Almost?) All systems also have an echo binary in /bin/echo, which may or may not have different options. F'rinstance on IRIX 6.5, /bin/echo changes its behavior based on an environment variable.

For many versions of echo, the following does what you want:

echo -n "Start check 1 for client" $1 ".........."

And for the other versions of echo:
echo "Start check 1 for client $1 ..........\c"
should do it.

And you should be able to put $1 inside double quotes by the way.

And check the print command in some shells which should have the -n option to forgo the NEWLINE.

Thanks Perderabo,

The '\c' did the trick.