[Top][All Lists]

[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 (X11/20090812)

David Aldrich wrote:

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 + 

but this gives a syntax error in the path.

What would be correct syntax please?

Best regards

Help-octave mailing list

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.


reply via email to

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