[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Can I pass filename to script called in shell?
From: |
Terry Duell |
Subject: |
Can I pass filename to script called in shell? |
Date: |
Fri, 20 Feb 2009 15:39:34 +1100 |
User-agent: |
Opera Mail/9.63 (Linux) |
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
- Can I pass filename to script called in shell?,
Terry Duell <=