FILE ERROR 2 with ⎕SH

Using Dyalog under 'nixes

FILE ERROR 2 with ⎕SH

Postby arcfide on Sat Oct 06, 2012 4:31 am

I am trying to learn how to run external programs with Dyalog, and I tried to run '/usr/bin/ls' ⎕SH '/', which actually gave me the output results that I expected. However, it also returned with an error saying FILE ERROR 2 file not found or some such.

What is going on here?
arcfide
 
Posts: 18
Joined: Fri Dec 09, 2011 3:53 am

Re: FILE ERROR 2 with ⎕SH

Postby AndyS|Dyalog on Sat Oct 06, 2012 2:48 pm

If you're trying to run ls or other commands, the correct syntax is:

      ⎕sh 'ls /'

or

      z←⎕sh'grep andys /etc/passwd'

It's always best to put an "; exit 0" at the end of the command string as a non-zero exit code from the command or pipe causes ⎕SH to generate a DOMAIN ERROR - and you might want to add a "2>&1" to capture any error text.

Dyadic ⎕SH is used to start Auxilary Processors (such as xutils); these are C-programs which when started cause additional functions to "appear" in the workspace - the source for many of the APs lives in $DYALOG/xfsrc. However, if you were thinking of building your own APs now then Dyalog would recommend that you create shared libraries instead, which can be invoked using ⎕NA.
User avatar
AndyS|Dyalog
 
Posts: 216
Joined: Tue May 12, 2009 6:06 pm


Return to UNIX and Linux

Who is online

Users browsing this forum: No registered users and 1 guest