Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello, I got a script which does backup for my databases, also I create a percentage to see how much is done.
The problem is that right now, the idea work line by line, meaning show the percent done.
Hello, I got a script which does backup for my databases...
printf 'Doing stuff:\n' is seems to work, but how can i do
Perhaps if you just posted your entire script (In CODE tags please - Just click Advanced" at the bottom of this quick-reply window, then the # button) this would be easier to solve for you.
Maybe you just need to use some ANSI control codes ( http://www.termsys.demon.co.uk/vtansi.htm ) to reset the cursor to the beginning of the line before you print the % done bit.
But if you really want it all on the one line, you are going to have to use some ANSI escape sequences from the link I gave you, to reset the cursor to the correct position on the current line before you do the printf
Well echo doesnt work.. [SNIP] ..and with the ANSI stuff, can u give me an example, never did this before so really dont know.
You need to do a bit of reading, research and learning. You also need to learn how to write, spell, punctuate, and use capitals, but I digress.
I am not going to do this all for you, but I'll happily give you an example to help you get started:
Try this in a terminal:
Code:
cat /var/log/messages
Your terminal will be filled with text.
Now enter:
Code:
echo -ne "\033[5;10f"
Now answer these questions for yourself, and feel free to experiment:
- What has happened to your cursor?
- Where is it in your terminal screen?
- Why did it move there?
- What happens if you just press <RETURN>
- What happens when you enter a command?
Now re-read the link I gave you to the ANSI Escape codes.
Then you'll find the answer yourself, and maybe will have learnt something that you can usefully use in the future.
You also need to learn how to write, spell, punctuate, and use capitals, but I digress.
If you wanna help, help, if not than please do not comment, English is not my mother language and of course errors will happen. If you do not like it, then just ignore my post, its not really that hard.
I asked for help from anyone who may know and wanna help out, I didnt ask an opinion on my English skills, if I would, you'll be the first to be informed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.