Basic ObjectScript not working in Linux Command Line
I’m a complete novice with ObjectScript.
I’m trying to write some Object Script directly into command line interface on Linux using some examples on the internet
sudo -u irisowner iris session SCRTC
Username: superuser
Password: ************
AUMHSCRTC:USER>a SET x=1
AUMHSCRTC:USER> WHILE x<10 {
AUMHSCRTC:USER> WRITE !," Looping",x
AUMHSCRTC:USER> SET x=x+1
AUMHSCRTC:USER> }
AUMHSCRTC:USER> WRITE !,"DONE"
AUMHSCRTC:USER>do a
Looping1
Looping2
Looping3
Looping4
Looping5
Looping6
Looping7
Looping8
Looping9
DONE
That seems to work!
How if I put these commands into a file:
cat > /tmp/a.scr
superuser
xyz
a SET x=1
WHILE x<10 {
WRITE !," Looping",x
SET x=x+1
}
WRITE !,"DONE"
do a
Then:
cat /tmp/a.scr|sudo -u irisowner iris session SCRTC
DOES NOT work.
Why?
Also “routine” or “class” code in Wikipedia - https://en.wikipedia.org/wiki/Cach%C3%A9_ObjectScript these examples do not work either directly or in a file:
hello // hello world routine
write "hello world"
end quit // end
DO ^hello
AND
Class User.Helloworld
{
ClassMethod HelloWorld()
{
// Write to console
Write "Hello World"
Quit
}
}
DO ##class(User.Helloworld).HelloWorld()
Why?
Thanks for any help