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