Run UNIX from rexx script 
Author Message
 Run UNIX from rexx script


 I am new in Rexx and I don't know how to run from rexx UNIX commads.


 / * rexx */

 call syscalls 'ON' address syscall

 ls -l /* UNIX command

 file1 /* name of unix file which I need to run */

 both commands dont work. Where is a problem?

Please any idea.

Boris Fain.

-- - USENET Gateway

Mon, 13 Dec 2004 19:43:28 GMT  
 Run UNIX from rexx script

>  I am new in Rexx and I don't know how to run from rexx UNIX commads.


Try this:

        ADDRESS SYSTEM "ls -l *"

        -- Aron

NB: To reply by e-mail, remove "spam-block." from my address.
- - - - - - - - - - -
"Do not follow the ideas of others, but learn to listen to the voice within
yourself. Your body and mind will become clear and you will realize the unity of
all things."

        -- Dogen (1200 - 1253)

Tue, 14 Dec 2004 00:38:44 GMT  
 Run UNIX from rexx script


> I am new in Rexx and I don't know how to run from rexx UNIX commads.

> f.e.

> / * rexx */

> call syscalls 'ON' address syscall

> ls -l /* UNIX command

> file1 /* name of unix file which I need to run */

> both commands dont work. Where is a problem?

>Please any idea.

Surround any commands which should go to the registered subcommand handler
(normally the command interpreter from which the REXX script is started) with
quotes (double or single).

'ls -l'


 - Mike

Remove '' and reverse to send e-mail.

Tue, 14 Dec 2004 08:55:13 GMT  
 Run UNIX from rexx script

%  I am new in Rexx and I don't know how to run from rexx UNIX commads.

%  f.e.

[english note: we generally use the latin abbreviation e.g. where in German
you'd use z.b.]

%  ls -l /* UNIX command

This is close. I'm going to expand on what Mike Ruskai said. Any statement
in rexx which has a result gets passed to the default `environment',
which is usually the shell when you're running from a command line, but
can be set using the address command. Also, if rexx is being used as a
macro language in an application, the default environment at start time
will often be application-specific.

In your case, rexx will first interpret
  ls -l
which probably gives an error, unless both variables ls and l have
numeric values, in which case, it will evaluate to the difference
of the two values. That difference is passed to the shell, so your
choices are:

  drop ls l
  ls -l
 Error 41 running "<stdin>", line 2: Bad arithmetic conversion


  ls = 12
  l = 3
  ls -l
9: not found

meaning that there is no command called 9. Putting it all in quotes
means that the expression evaluates to `ls -l', which will then be
executed as you expected the first time.

You can build up that string any way you like, though, for instance

  ls = 'ls -l'



  ls: procedure
    return 'ls -l'

It's more common to do something like this, though:

  lsflags = getlsflags()

  /* ... */

  'ls' lsflags

where getlsflags is some function which queries a configuration file
or database for the flags to use.

This is convenient, but leads to the sometimes irritating call statement.
If you're not interested in the results of a function, you must either
invoke like so:

  call fn arg1,arg2, ...

or assign and ignore the return code

  call =  fn(arg1,arg2, ...)

My clever trick for allowing

  fn(arg1, arg2, ...)

to work as you might expect based on experience with other languages
is to switch to a dummy environment:

  trace 'o'     /* this is part of the hack -- you must do it */
  address null  /* the name used here can be any _invalid_ address */

  fn(arg1, arg2, ...)

At least one person thought this was really neat.

Patrick TJ McPhee
East York  Canada

Tue, 14 Dec 2004 10:15:07 GMT  
 Run UNIX from rexx script

> I am new in Rexx and I don't know how to run from rexx UNIX commads.

Actually, the problem is not specific to Unix.

> call syscalls 'ON' address syscall

Are you sure that you didn't mean

   call syscalls 'ON'; address syscall


   call syscalls 'ON'
   address syscall

> ls -l /* UNIX command

The first problem is that you don't want to subtract l from ls, you
want to execute "ls -l" as a command. You need an expression  that
evaluates to "ls -l", and the easiest one is

   "ls -l"

Second, you haven't changed the default environment. Read up on the
address statement.

Third, you don't have the trailing comment delimitor, "*/"

Presumably what you wanted was

   "ls -l" /* UNIX command */

> file1 /* name of unix file which I need to run */

Again, you need the correct environment. Also, if you meant "file1" to
be the actual file name rather than a variable containing the name,
then you need to quote it. Otherwise, "file1" will be treated as a
variable name and the results will not be what you want'

Note that the default behavior of REXX with uninitialized simple
variable is to provide the upper case name as a value, while Unix file
names are case sensitive. So in general REXX code generating Unix
commands cannot take advantage of the standard abbreviation technique
of letting uninitialized variable names stand for themselves.

     Shmuel (Seymour J.) Metz, SysProg and JOAT
     Atid/2, Team OS/2, Team PL/I

Any unsolicited commercial junk E-mail will be subject to legal
action.  I reserve the right to publicly post or ridicule any
abusive E-mail.

I mangled my E-mail address to foil automated spammers; reply to
domain Patriot dot net user shmuel+news to contact me.  Do not

Thu, 16 Dec 2004 10:06:32 GMT  
 [ 5 post ] 

 Relevant Pages 

1. using Rexx to run a Unix script from NT

2. REXX CGI scripts under UNIX with Regina REXX

3. Final SRFI 22: Running Scheme Scripts on Unix

4. SRFI 22: Running Scheme Scripts on Unix

5. how to run python script from Unix Shell?

6. run pythonwin scripts remotely from unix -- how?

7. running unix commands from insdie expect script

8. HELP: unix command cd doesn't run in a tcl-script

9. Wanted: Expect script for running UNIX dump command

10. -Q: How to run a Unix command from Tcl script

11. REXX Helped Me Hit the Ground Running in unix

12. Running REXX from UNIX


Powered by phpBB® Forum Software