Can I pass filename to script called in shell?
Terry Duell
tduell at iinet.net.au
Thu Feb 19 22:39:34 CST 2009
Hullo All,
The subject sounds a bit circuitous, hopefully I will be able to explain
what I am trying to do.
I have a script file (run-psd.m), as follows...
file = read(argv(){2});
acc = dlmread(file);
psd = autspec(acc,dt,win,raw);
save -ascii psddata psd
And I want to be able to use that from a shell, as follows...
#! /bin/sh
for ACC in `cat accfile`
do
octave run-psd.m /driver-acc/$ACC
gnuplot plotpsd
mv psd.ps psdfiles/$ACC-psd.ps
done
echo "All done"
All my input files are listed in the file'accfile'.
my script file (run-psd.m) works OK from the commandline if I replace the
first line with 'file = input("Acc-time history filename ","s");' or
similar. This is OK for testing or a small number of input files and I
manually enter the filename, but I would like to automate it to handle a
large number of files.
I am getting an error 'read' undefined, so clearly I don't have the right
syntax, or maybe not even the right approach.
Could someone please point me in the right direction?
Cheers,
--
Regards,
Terry Duell
More information about the Help-octave
mailing list