ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
This should be a simple one for all you programming gurus
Kind of hard for me to explain and I'm sure there's a guide out there that tells how to do it, I just don't know what to search for (believe me I tried).
What I am looking to do is create that alternating dash mark that shows the script is working.
It sort of looks like this while working, except all the same line, with the last character appearing to be spinning.
Moving /dir1/file to /dir2/file... /
Moving /dir1/file to /dir2/file... -
Moving /dir1/file to /dir2/file... \
Moving /dir1/file to /dir2/file... /
Moving /dir1/file to /dir2/file... -
Moving /dir1/file to /dir2/file... \
Does this make any sense?
Thanks for any help,
-xvalentinex
Last edited by xvalentinex; 12-07-2005 at 12:56 PM.
Is this ultimately similar to what you're trying to achieve? I know it doesn't answer your question but if somebody has done the work already no need to start again if you don't have to
Yeah sort of like that, but on a much simpler scale.
I took a look at the source hoping to grab some tidbits, but It looks like c and a very long source at that. I just need something really simple that shows the script is working.
I didn't mean to copy the code, your example script was moving a file. I figured if you just wanted to pretty up mv a little then that's been done already
The spinner is perfect, and cs-cam that definately helps and simplifies while looking better too. To be more clear what I am trying to do is unrar some files and move them to a network server. The spinner is great since I am sending the rar output to /dev/null and the progress bar works for the move portion.
I'm still quite a newb at linux and especially scripting. Perhaps someone could shed some light on what I need to do to have the spinner going while the file is unraring.
Here is a snippet of what I have but it doesn't work.
Code:
#!/bin/bash
# Author:
# Created 12.05.2005
# Spinner function
spinner() {
sleep 1
echo -ne "\b\\"
sleep 1
echo -ne "\b|"
sleep 1
echo -ne "\b/"
sleep 1
echo -ne "\b-"
}
# Getting files extracted to ./
for CDNUM1 in {CD,cd}1
do
if [ -d $CDNUM1 ]
then
echo Now working on $CDNUM1
CD1AVI=`rar vb ./$CDNUM1/*.rar`
echo The file for CD1 is $CD1AVI
echo -ne "-"
while [ `rar e ./$CDNUM1/*.rar ./ > /dev/null` ]
do
spinner
done
echo Done extracting $CD1AVI
fi
done
Last edited by xvalentinex; 12-06-2005 at 07:42 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.