From help-octave-request at bevo dot che dot wisc dot edu Thu Jan 15 03:42:02 2004 Subject: Re: alias-like function? From: Geraint Paul Bevan To: Avraham Rosenberg CC: =?ISO-8859-1?Q?S=F8ren_Hauberg?= , help-octave Date: Thu, 15 Jan 2004 09:49:00 +0000 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Avraham Rosenberg wrote: | I read your mail and thought: what I nice trick. | But when I tried it, octave refused to behave. It complained instead of | "octlc undefined near line 4 column 1" | octave 2.1.50 on debian 3.0r1 | 1028~> EXEC_PATH | EXEC_PATH = | /home/avraham/matcompat/bin::/home/avraham/scripts:/usr/local/MuPaD_200/share/bin:/home/avraham/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games | | The script octlc -a copy of the one you posted is in | /home/avraham/matcompat/bin and it is executable. | Moreover, while the binary files in the path are recognized by octave, | it balks at all my scripts (starting with the magic #!/bin/sh | sequence). | Any suggestions ? | Thanks, Avraham | The problem here is that Octave doesn't usually try to run shell scripts or other system calls when functions are called. It usually looks for .m and .oct files; "ls" is a special case. If you want the command "octlc" to run a bash shell script in Octave, the easiest way is to create a wrapper "octlc.m" which uses the "system" function and to place it in your Octave path: geraint at pavilion:~$ cat bin/octlc #!/bin/sh echo Hello World geraint at pavilion:~$ cat octlc.m system ("/home/geraint/bin/octlc"); geraint at pavilion:~$ octave -q octave:1> octlc Hello World octave:2> Inidentally, the "ls" script I posted before should have had $* at the end of the command so that ls would continue to accept arguments from the shell: #! /bin/sh exec /bin/ls --color $* - -- Geraint Bevan http://homepage.ntlworld.com/geraint.bevan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iEYEARECAAYFAkAGYgwACgkQcXV3N50QmNO/CQCggp/u4P+ozysYLXnOj2GNUtkF kKwAoInD3c8lZFyDEMiL5lL8Acz8CkDA =kzgF -----END PGP SIGNATURE----- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------