This may be a general question, but I'm new to octave and want to get a string from the command line. However, I'm not sure what format the command line arguments are in. I have attempted typing:
myscript hi
myscript --hi
myscript -hi
myscript (hi)
at the command line but I keep on getting this error:
error: invalid use of script "myscript filepath" in index expression
so I'm apparently not calling this correctly. The --hi is the format that is shown on the official website but it doesn't appear to work for me. This script, I got off online just to test:
#! /usr/bin/octave -qf
printf("%s", program_name());
arg_list = argv();
for i = 1:nargin
printf(" %s", arg_list{i});
end
printf("\n");
Is there something I need to implement in order for argv to work?
myscript.m "--hi"and see if you get the same error. Also try running the script without any arguments to see if you get an error. - andyras