FILE ERROR 2 with ⎕SH
2 posts
• Page 1 of 1
FILE ERROR 2 with ⎕SH
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?
What is going on here?
- arcfide
- Posts: 19
- Joined: Fri Dec 09, 2011 3:53 am
Re: FILE ERROR 2 with ⎕SH
If you're trying to run ls or other commands, the correct syntax is:
or
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.
⎕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.
-
AndyS|Dyalog - Posts: 263
- Joined: Tue May 12, 2009 6:06 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group