• String quotes in command arguments?
    2 replies, posted
To start off, here's my example code: [CODE] require("cmd") function WriteFile() cmd.exec("echo 'test1' >> test.txt") end [/CODE] This code works fine. However, how would I accomplish using quotes in the argument? Example: [CODE]cmd.exec("echo ' "test" ' >> test.txt")[/CODE]
[lua] local test = "test1" cmd.exec("echo ' "..test.." ' >> test.txt")[/lua] ? or do you mean [lua] cmd.exec("echo ' \"test\" ' >> test.txt")[/lua]
Either one works :D Thanks! EDIT: Is it possible to put quotes around a concatenation? like the first example, but if the "test" variable couldn't have quotes. Like if I wanted to append player:GetName to text.txt so it shows up like "playername" in the file. EDIT2: Nevermind, I figured it out! [CODE] local test = test cmd.exec("echo ' \""..test.."\" ' >> test.txt") [/CODE] EDIT3: Erm, I'm getting "Unterminated String" when trying to run this... EDIT4: Okay, last edits. I'm an idiot. I forgot that second ' to close off the string.
Sorry, you need to Log In to post a reply to this thread.