changeset 13900:5859cf1d57a6

quote filenames passed to the shell * ls.m: Quote filenames passed to the shell.
author John W. Eaton <jwe@octave.org>
date Mon, 21 Nov 2011 04:10:37 -0500
parents 764d2bc59a6f
children 3af19cfc2e0f
files scripts/miscellaneous/ls.m
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/ls.m	Mon Nov 21 04:06:52 2011 -0500
+++ b/scripts/miscellaneous/ls.m	Mon Nov 21 04:10:37 2011 -0500
@@ -50,7 +50,15 @@
 
     args = tilde_expand (varargin);
 
-    cmd = sprintf ("%s ", __ls_command__, args{:});
+    if (nargin > 0)
+      ## FIXME -- this will fail for filenames that contain single quote
+      ## characters...
+      cmd = sprintf (" '%s'", args{:});
+    else
+      cmd = "";
+    endif
+
+    cmd = sprintf ("%s%s", __ls_command__, cmd);
 
     if (page_screen_output () || nargout > 0)