[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: safe shell strings
From: |
Andreas Weber |
Subject: |
Re: safe shell strings |
Date: |
Fri, 07 Mar 2014 08:59:21 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 |
On 06.03.2014 17:38, Richard KIrk wrote:
> Is there any generic function that takes a string such as a filename, and
> turns it into something that can be quoted in a single command line string
> for the shell that system() is going to use?
I don't understand your question but...
If you want to form filenames, have a look at "fullfile" and "fileparts"
These use filesep() which is system-dependent:
on GNU/Linux:
octave:> fullfile("/home","user","myfile.log")
ans = /home/user/myfile.log
On windows you'll get backslashes..
Or are you searching for escape functions like "do_string_escapes" and
"undo_string_escapes"?
> Well, actually I probably do, but I
> am going to strtrim() the name and stick it in double quotes. I don't know
> if that works in Windows shells, but It WIll Do For Now.
If you explain what you are trying to do it's more likely that you get
more applicable answers.
-- Andy