how to get some sort of graphics using shell scripts?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to get some sort of graphics using shell scripts?
# 1  
Old 06-03-2008
how to get some sort of graphics using shell scripts?

Hi all,
I would like to know how to have graphics embedded using shell scripts...
I mean simple =========>
or ---------> would do...
The main idea here is for every element of the bar to move for every % completion of data.....

I tried echo under a for loop ,but it was not giving me o/p that i could use?

eg:,
lets say that i want to install a pkg, a huge one...now for every % of the installation completed i would like to have "===>" ,move one step ahead....

If this is difficult to incorporate then i woudnt mind having a regular % counting itself (with numericals)

Thanks
# 2  
Old 06-03-2008
If you get number of files to be installed, you can use the following as a starting point
Code:
count=0
while [ $count -le 10 ]; do
      count=`expr $count + 1`
      sleep 1
      echo -n =
done
echo " Done"

# 3  
Old 06-03-2008
I thought of that, but then it is compressed and if i have to find out the no of files in it then i will have to extract then perform the codes youve given..
Which i feel could incur overhead!!!

Could you tell me if its possible to compare the size of the file at the destination against the source then use it as a delimiter?

Thanks
# 4  
Old 06-03-2008
I think you're mixing up two things. When exactly to print another character is probably fairly specific to your particular problem. Assume the screen is 80 characters wide, or use curses or the $COLUMNS environment variable to figure out how wide the user's screen is. Then however you want to calculate the % completion, divide 100% by 80 (or whatever other value you came up with) and print another character when another 1/80 has been completed.

A fairly traditional "pretty" progress bar would use the fact that carriage return will return the cursor to column 1 without advancing to a new line (newline does that). So you can create an illusion of a growing bar by printing "=>\r" then "==>\r" then "===>\r" and so forth. I believe the progress bar example I presented a couple of weeks ago demonstrated this (albeit with numbers instead of ASCII graphics).

Last edited by era; 06-03-2008 at 01:02 PM.. Reason: Link to earlier example
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell basic graphics demo.

I have been thinking about another shell scripting project using the Arduino Diecimila board. I was going to make a kids level slow 8 channel Logic Analyser. I thought about using the termiinal esc code graphics characters. This is the test code using said terminal escape codes. I have only... (2 Replies)
Discussion started by: wisecracker
2 Replies

2. OS X (Apple)

[Solved] links2 --enable-graphics from source, configure error: no graphics driver found.

Howdy I am trying to install links2 with graphics support on snow leopard 10.6.8 (xcode installed). I have had the program running last year, also installed from source - but then I had installed some image libraries with mac ports and fink - cannot reproduce that setup. Plus I would like to not... (6 Replies)
Discussion started by: butterbaerchen
6 Replies

3. Shell Programming and Scripting

sort shell

Hello, reéaliser I'd like a program that sorts the entries in a directory under different options: -R: Sorting the contents of the directory tree starting at pos. In this case we will sort with respect to the names of the entries but it will show the path; -D: sort in descending order by... (1 Reply)
Discussion started by: yaya125
1 Replies

4. Shell Programming and Scripting

sort shell?

hello my problem is that I have to do diferents sorts shells with diferents logical algorithms like shell sort, select sort, quick sort and bubble sort. starting from a basic shell that says something like: file = cat $1 sortLogic = $2 colSort = $3 source sortLogic file colSort > $4 ... (1 Reply)
Discussion started by: edgar287
1 Replies

5. Shell Programming and Scripting

calling 'n' number of shell scripts based on dependency in one shell script.

Hello gurus, I have three korn shell script 3.1, 3.2, 3.3. I would like to call three shell script in one shell script. i m looking for something like this call 3.1; If 3.1 = "complete" then call 3.2; if 3.2 = ''COMPlete" then call 3.3; else exit The... (1 Reply)
Discussion started by: shashi369
1 Replies

6. Shell Programming and Scripting

Shell Scripts

deleted (1 Reply)
Discussion started by: zxc
1 Replies

7. HP-UX

Shell Scripts

I have a text file . Format of text file. djss:xd:78:isdev:"test server" this type of row. (approx 30). I want to display like that 1. djjs@msxd testserver 2. xjfd@msxd devserver 3. 4 select any one from above choice : 1... (5 Replies)
Discussion started by: rastogideepak
5 Replies

8. Shell Programming and Scripting

Need Help With Shell scripts

Hello, I'm very very fresh with unix, and I would like to get familiar with it. I want to know what is Shell scripting and how other programming languages connects with it. And is there any way to learn the shell scripting, with some book and some simulator to practice on. Thanks ahead. (2 Replies)
Discussion started by: holler1
2 Replies

9. AIX

Difference between writing Unix Shell script and AIX Shell Scripts

Hi, Please give me the detailed Differences between writing Unix Shell script and AIX Shell Scripts. Thanks in advance..... (0 Replies)
Discussion started by: haroonec
0 Replies
Login or Register to Ask a Question