Pass a variable number of bash command line arguments to a MATLAB function Pass a variable number of bash command line arguments to a MATLAB function unix unix

Pass a variable number of bash command line arguments to a MATLAB function


Taking inspiration from here:

#!/bin/bashINPUT=$(printf "'%s'," "$@") && INPUT=${INPUT%,}echo matlab -nodesktop -nosplash -nodisplay -r "my_function($INPUT)"

Output:

$ ./test.sh one two threematlab -nodesktop -nosplash -nodisplay -r my_function('one','two','three')

It's a little shorter, at least.