help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alias-like function?


From: Geraint Paul Bevan
Subject: Re: alias-like function?
Date: Thu, 15 Jan 2004 09:49:00 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031221 Thunderbird/0.4

-----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:


address@hidden:~$ cat bin/octlc
#!/bin/sh
echo Hello World

address@hidden:~$ cat octlc.m
system ("/home/geraint/bin/octlc");

address@hidden:~$ 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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]