help-octave
[Top][All Lists]
Advanced

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

Re: shell script location


From: Richard Crozier
Subject: Re: shell script location
Date: Tue, 08 Jan 2013 19:32:44 +0000
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

On 08/01/2013 18:27, Jordi Gutiérrez Hermoso wrote:
On 8 January 2013 12:54, RC Crozier <address@hidden> wrote:
Quoting Jordi Gutiérrez Hermoso <address@hidden> on Tue, 8 Jan 2013
12:35:44 -0500:

WFM, what OS are you using and what Octave version?

     address@hidden:~$ ./lol.m
     ans = lol
     ans = /home/jordi/lol
     ans = /home/jordi/lol.m

     address@hidden:~$ cat lol.m
     #!/usr/local/bin/octave -q
     mfilename
     mfilename fullpath
     mfilename fullpathext

Sorry I sent some nonsense in the last email I meant:


bash-4.1$ cat ./temp/lol.m
#! /home/s0237326/bin/share/bin/octave -qf

x = which(mfilename)
whos x
disp(which(mfilename))

which won't give you a directory. How about regexping it instead?

     cd(regexprep(mfilename("fullpath"), "[^/]*$", ""))

HTH,
- Jordi G. H.


Yes, this works thanks, although I will probably use

fileparts(mfilename("fullpath"))

for clarity.

Thanks again for the help!

Richard




--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



reply via email to

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