Sponsored Content
Top Forums Shell Programming and Scripting Gnuplot shell script controlled animation Post 302275072 by darius2 on Friday 9th of January 2009 06:33:53 AM
Old 01-09-2009
Quote:
Originally Posted by cfajohnson

What data do you want to feed to gnuplot?

How does gnuplot accept its data? Command line? Standard input? File?

Why a one-liner?
Dear Mr. Johnson,

thank you very much for your kind reply.

I have played with gnuplot in the night and here are my basic results.

Having learned loop syntax for code refresh in gnuplot
load "loop3.plt"

loop3.plt code
==========
a = a + 1
f(x) = (x*x+a)

plot f(x)

if(a<5) reread


===========
init terminal strings

[admin@oo local]$ gnuplot

G N U P L O T
Version 4.2 patchlevel 4
last modified Sep 2008
System: Linux 2.4.20

Copyright (C) 1986 - 1993, 1998, 2004, 2007, 2008
Thomas Williams, Colin Kelley and many others

Type `help` to access the on-line reference manual.
The gnuplot FAQ is available from gnuplot: FAQ

Send bug reports and suggestions to <http://sourceforge.net/projects/gnuplot>


Terminal type set to 'unknown'
gnuplot> set terminal dumb
Terminal type set to 'dumb'
Options are 'feed 79 24'
gnuplot> a=-5
gnuplot> load "loop3.plt"

(I get series of slides generated)

110 ++---------------+-----------------+----------------+---------------++
* + + + f(x) ****** *
100 +* *+
| * * |
90 ++ * * ++
80 ++ * * ++
| ** ** |
70 ++ * * ++
| ** ** |
60 ++ ** ** ++
| * * |
50 ++ ** ** ++
| * * |
40 ++ ** ** ++
| ** ** |
30 ++ *** *** ++
20 ++ ** ** ++
| *** *** |
10 ++ ***** ***** ++
+ + ************ + +
0 ++---------------+-----------------+----------------+---------------++
-10 -5 0 5 10

gnuplot>

========
Modified code to
a = a + 1
f(x) = (x*x+a)
plot f(x)
clear
if(a<5) reread

but still a series of slides is generated.
Expected to clear screen before next slide is sent to terminal.

Ok.
So the above example is my first test in basic gnuplot animation on ASCII dumb terminal.

============
In the meantime I visited
your Shell Scripting Recipes
reading sample chapter
and testing your

split_date "DATE" [VAR1 [VAR2 [VAR3]]]

saved script code as splitdate, chmod 777 ./splitdate
and try to run it
[admin@oo root]$ ./splitdate "1949-09-29"
[admin@oo root]$ printf "$format" "$SD_DAY" "$SD_MONTH" "$SD_YEAR"
Day:
Month:
Year:
[admin@oo root]$

Could you kindly tell me how to make it working ?

I copy&pasted it into nano editor
appended
#!/bin/sh
and saved into root directory
chmod 777 ./splitdate

How to make it run
$ splitdate
instead of
$ ./splitdate ?

==================
split_date()
{
## Assign defaults when no variable names are given on the command line
sd_1=${2:-SD_YEAR}
sd_2=${3:-SD_MONTH}
sd_3=${4:-SD_DAY}

oldIFS=$IFS ## save current value of field separator
IFS="-/. $TAB$NL" ## new value allows date to be supplied in other formats
set -- $1 ## place the date into the positional parameters
IFS=$oldIFS ## restore IFS
[ $# -lt 3 ] && return 1 ## The date must have 3 fields

## Remove leading zeroes and assign to variables
eval "$sd_1=\"${1#0}\" $sd_2=\"${2#0}\" $sd_3=\"${3#0}\""
}


your Shell Scripting Recipes:


8: The Dating Game
example chapter.

I am just learning basics of Unix shell scripting
and moving from MS Vista to Linux environment is really hard.


From Vista laptop I putty Linux embedded device
and get access to ASCII dumb terminal.

I copy example script code c&p from Firefox MS Vista window
open nano script_name application
paste the code
append
#!/bin/sh

save, close, exit nano
chmod 777 ./script_name
and try to run script in another terminal session.

So to test and edit 10-20 example scripts takes me the whole night.

Are you aware of another option to test example shell script from the net on-the-fly ?
In Firefox I can run javascript / php scripts
Mayby I can use Lynx.
Unfortunately example shell script code doesn't come
as html code to be downloaded for immediate execution.

I installed basic http server.
Mayby I could save example shell scripts to local http server
and run them locally.

Any idea ?

file.plt is another scripting language I have to master,
so I am looking for a working test
of how to pipe Unix shell script output into
gnuplot > plot "< shellscript"

Tried in the night really hard and failed.

Darius
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

3d animation

What are the benefits to using UNIX for 3d animation. I am looking into the field, and most places require a strong background in UNIX. Why is this? (3 Replies)
Discussion started by: aloysius1001
3 Replies

2. Filesystems, Disks and Memory

IDE controlled / RAID card issue Suse 9.2

I just built a new box to run Suse, and I guess I shoud have spent more time researching the HCL. Anyway, the Promise RAID card I have will not work, and I am unable to install the OS. The only other IDE devide in the box is a DVDOM. I can only think of 2 options, but would appreciate some... (1 Reply)
Discussion started by: 98_1LE
1 Replies

3. UNIX for Dummies Questions & Answers

script animation

I have read hundreds of the postings and cannot find the answer to my question...so I hope that someone is able to answer it for me. I am writing a script in bash, and would like to add animation. I have a gif file that I would like to open and have displayed on the screen. Can this be done? Of... (0 Replies)
Discussion started by: debit
0 Replies

4. Shell Programming and Scripting

Shell Script Animation

Hi, I want to write a shell script which can do some animation The animation is as follows it is like a progress barwhich hould gone on inresing with time & at the end of the line there should be the progess Eg == - 10%... (2 Replies)
Discussion started by: wojtyla
2 Replies

5. Shell Programming and Scripting

Controlled For Loop

I have a for loop and i pass in number of times i want to loop as argument to script. I have attached a snippet of my script. Problem is this does not work, if I manually replace the $NO_OF_LOOPS with a number in the script it works fine. NO_OF_LOOPS=$1 for i in {0..$NO_OF_LOOPS} ... (8 Replies)
Discussion started by: kelseyh
8 Replies

6. Shell Programming and Scripting

Passing gnuplot variables to shell script

Hi, I need to pass a gnuplot value to a shell script. I have a main shell script (Main.sh) that has a bunch of gnuplot commands. Main.sh calls another gnuplot script (Child.gnu). A part of the code in Child.gnu is as follows: sp '</data/src/scripts/results/plot_data.sh $col' u (A):2:3 w pm3d... (8 Replies)
Discussion started by: annazpereira
8 Replies

7. Shell Programming and Scripting

Using variables in gnuplot within a shell script

Hi everybody, please help me with this problem Suppose I have a script like this to run commands of gnuplot. #!/bin/sh lib=$1 old="output/old/$lib.dat" new="output/new/$lib.dat" gnuplot << EOF set logscale x set logscale y set size square set grid set pointsize 1 plot "< paste $old... (5 Replies)
Discussion started by: Dark2Bright
5 Replies

8. Solaris

In cluster configuration ora* VGs are not controlled by VCS

Need some one to explain "In cluster configuration ora* VGs are not controlled by VCS". Actually, I am not aware of this. Thanks, Rama (0 Replies)
Discussion started by: ramareddi16
0 Replies

9. Shell Programming and Scripting

Pass shell variable to gnuplot

Hi I am plotting a series of CDFs using gnuplot using plot "data" u 1:(1./x.) smooth cumulative I am doing this over many files and I need to tune the x value to the number of lines that meets a particular condition. Is it possible to get the line count from shell using cat file | grep... (7 Replies)
Discussion started by: jamie_123
7 Replies

10. Shell Programming and Scripting

Gnuplot script

Need assistance in getting a script right. It requires little tweaking and I am not getting it right . Using below data and the below script it creates a table with png file but regarding the time it create 6,7,8 and i want each time 6:15 ,6:30 and so on So that i can view the exact graph... (3 Replies)
Discussion started by: ajayram_arya
3 Replies
All times are GMT -4. The time now is 04:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy