exec() bug in handling embedded blanks
Posted by
Neil Fazel on
Jul 22, 2014; 2:59am
URL: http://imagej.273.s1.nabble.com/exec-bug-in-handling-embedded-blanks-tp5008844.html
I'm using exec() to run a native command from the ImageJ macro code. This code (note the single quotes inside the double quotes)
cmd="ls '"+directory+"/'*avg.txt";
print(cmd);
templist = exec(cmd);
doesn't seem to work (templist is blank) whereas if I copy the value of cmd from the log window to the Unix prompt, it works. I think it's because the variable 'directory' has embedded blanks in it and exec() can't handle blanks in path names.
I'm working on Mac and it is not uncommon for directory paths to have blanks in them. Is there a way around this?
BTW, the reason I'm using exec() is because getFileList() doesn't work with wildcards, so exec() seems to be the only way I can get a list of the files matching a certain pattern.
Thanks,
Neil
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html