stdout instead of print?
[1/3] from: balayo:mindspring at: 7-Sep-2000 23:03
howdy guys,
>>print date-string
==0907225000
Instead of printing date-string, how can I get it to stdout,
so I can pipe it to date?
--
Spend less time composing sigs.
-tom
[2/3] from: joel:neely:fedex at: 8-Sep-2000 10:24
Print DOES send data to stdout, but not if you're running in an
interactive session.
Create a file named testing.r (assuming you're in a *nix/*nux
environment, as you asked about piping and date) which reads as
follows (not including the hyphen-bar delimiters:
=============================================================
#!/usr/local/bin/rebol -sq
REBOL []
; set this variable however you wish...
date-string: "0907225000"
print "this"
print "is"
print "a"
print "test"
print date-string
=============================================================
The first line may need to be different on your system, depending
on where you have installed REBOL.
Now, at the shell, enter the commands
=============================================================
chmod 744 testing.r
./testing.r
./testing.r | sort
=============================================================
The first command makes the file executable. The second should
produce the output:
=============================================================
this
is
a
test
0907225000
=============================================================
The second should produce the output:
=============================================================
0907225000
a
is
test
this
=============================================================
That's how to pipe from REBOL to another process.
Having said all that...
You can only set the date on your system as root. Where is the
script getting the value of date-string from? I'm just highly
puzzled as to the use (and safety) of the exact example you asked
about.
-jn-
[balayo--mindspring--com] wrote:
[3/3] from: balayo::mindspring::com at: 8-Sep-2000 20:28
Howdy guys,
Thanks Joel,
> Having said all that...
>
> You can only set the date on your system as root. Where is the
> script getting the value of date-string from? I'm just highly
> puzzled as to the use (and safety) of the exact example you asked
> about.
>
> -jn-
I just wrote a simple script that grabs the appropriate line from
the Navy's time page, then makes a string of digits out of it that
date can easily use.
I was going to write a litte shell script, and just wanted to make
the results of the rebol script usable by it. It might be as easy
as
#!/bin/sh
date < rebol-generated.txt
or
date << rebol-generated.txt
or
date | rebol-generated.txt
(can't remember which off-hand)
I don't think this will work quite right, though, becuse of the lag
between the execution of each script (the *.r then the *.sh)--the time
would be wrong by a few seconds.
does that make any sense?
--
Spend less time composing sigs.
-tom