help-octave
[Top][All Lists]
Advanced

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

Re: Linux environment variable question


From: David Grundberg
Subject: Re: Linux environment variable question
Date: Wed, 03 Feb 2010 16:42:35 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090812)

David Aldrich wrote:
Hi

I need to run a function under Octave that requiries two filenames as 
parameters. The parameters must be full paths, but the paths are long, so I 
want to specify part of the path by an environment variable. However, I can't 
get the syntax right. Here is what I do:

$ mypath = 'home/myname'
$ octave -q --eval "fprintf('%x', RegressionTest($mypath + 'filename1', $mypath + 
'filename2'))"

but this gives a syntax error in the path.

What would be correct syntax please?

Best regards

David
_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

I think you could attack the problem from a different angle, to save yourself some quoting headaches. Write a script file interpretable.m containing:

#!/usr/bin/octave -qf
arg_list = argv ();
printf ("%x", RegressionTest (arg_list{1}, arg_list{2}));

and then execute

chmod u+x interpretable.m
./interpretable "$mypath/filename1" "$mypath/filename2"

Notice the shell quotes, they are significant.

This way you allow the shell do the part of the job it is supposed to do.

hth
David



reply via email to

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