Not a question but nice inclusion in scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not a question but nice inclusion in scripts
# 1  
Old 05-09-2003
Computer Not a question but nice inclusion in scripts

Hi there,

I produced a script that can sometimes take a lot of time to run. To make sure that it was running I was printing ". " to the screen. I found this could easliy scroll through lots of pages before it finsihed. So I came up with this.

I put this at the beginnig.

Code:
do_next()
{
        echo "\b\b\b${next[${next_count}]}\c"
        let next_count=$next_count+1
        if [ $next_count -gt 3 ]
        then
        {
                next_count=0
        }
        fi
}

initialise()
{
        next[0]="[\\]"
        next[1]="[|]"
        next[2]="[/]"
        next[3]="[-]"
        next_count=0
}


initialise

Then after a point in your script were your taking an action you can invoke do_next. I do it after a succesful rm file, just to show it is removing files.

Enjoy.

Neil Hatch
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

General question about passing variables among shell scripts

So this is something I've been wondering how to do for a while. Suppose I have two shell scripts a.sh and b.sh script a does some function and outputs to a varable $x . I would then like to take $x into the second function, b.sh, and do a function on it and create some output. So how do you pass... (3 Replies)
Discussion started by: viored
3 Replies

2. Shell Programming and Scripting

Asynchronous shell scripts question - newbie

Hi All, I am fairly new to UNIX and very new to this forum too. This is my first post here. Here is my scenario - I have 3 scripts script1, script2 and script3. I want to start script1 and script2 asynchronously. Upon completion of both scripts script1 and script2, i want to fire the last... (4 Replies)
Discussion started by: taskeen21
4 Replies

3. Shell Programming and Scripting

Question about argument parsing in scripts

Hello all, I am relatively new to linux and bash scripting. I have what seems to be a simple question but I'm having trouble finding the answer. The question is what is the difference between the variables $@ and $*. I've seen them both used in the same context, and I've tried a number of... (4 Replies)
Discussion started by: nicthu
4 Replies

4. Shell Programming and Scripting

Inclusion of Code in Script File

I tried creating a simple text file to get the query output, but the data was just thrown into the text file. There was no format. what should i include code in my script file (containg the select query) so that the output to the text file is formatted neately with tab. I also donot... (2 Replies)
Discussion started by: bankimmehta
2 Replies

5. Shell Programming and Scripting

Newbie question-do I pause and exec my shell scripts?

Hi there, I'm writing a script to restore 3 directories and 3 mysql db's every 24 hours. While writing the script, I came across the thought... Do I need to pause between executions? Example: msql restore1.sql rm -Rf path1/* cp -Rf path1/* /restore1 chmod 777 /folder1/cache1 ... (2 Replies)
Discussion started by: semiotics101
2 Replies

6. Shell Programming and Scripting

A question about the newline character in KornShell scripts

Dear all, How can we know in a KornShell script reading a value from the standard input, that the entered value is the newline character? because as far as I know we cannot use \n for pattern matching. For example: #!/bin/ksh print -n "enter your value: " read VALUE if ] then ... (2 Replies)
Discussion started by: dariyoosh
2 Replies

7. Programming

nice command and nice() system call

Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies

8. Shell Programming and Scripting

shell scripts question

Hi I am trying to do the following use a shell script to draw from various online table to the table on my server. it draws from one online table which has a set of columns one of which is in the form say 2006ab i want to use this as input to copy into another column an http link that has... (0 Replies)
Discussion started by: wannabegeek
0 Replies

9. UNIX for Advanced & Expert Users

Question regarding nice

If i use nice/renice to increase the priority of any process, will that process get a higher priority when it comes to I/O? If there are two processes waiting on I/O requests, will the process that has a higher priority have its I/O request processes first? This came up in a discussion at work,... (2 Replies)
Discussion started by: blowtorch
2 Replies

10. Shell Programming and Scripting

two simple question on shell scripts....

:D my first question is how can envoke filename expansion from within a shell script.. forinstance if i execute the script and it asks for a specific directory that i would like to cd to, how can i get the script to use the same file name expension as the command line.. my second question is how... (3 Replies)
Discussion started by: moxxx68
3 Replies
Login or Register to Ask a Question
script(1)							   User Commands							 script(1)

NAME
script - make record of a terminal session SYNOPSIS
script [-a] [filename] DESCRIPTION
The script utility makes a record of everything printed on your screen. The record is written to filename. If no file name is given, the record is saved in the file typescript. See WARNINGS. The script command forks and creates a sub-shell, according to the value of $SHELL, and records the text from this session. The script ends when the forked shell exits or when Control-d is typed. OPTIONS
The following option is supported: -a Appends the session record to filename, rather than overwriting it. NOTES
script places everything that appears on the screen in filename, including prompts. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) WARNINGS
script can pose a security risk when used in directories that are writable by other users (for example, /tmp), especially when run by a privileged user, that is, root. Be sure that typescript is not a link before running script. SunOS 5.10 30 Jan 2004 script(1)