au.net.causal.maven.plugins.boxdb.db.ScriptUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boxdb-maven-plugin Show documentation
Show all versions of boxdb-maven-plugin Show documentation
Maven plugin to start databases using Docker and VMs
package au.net.causal.maven.plugins.boxdb.db;
public final class ScriptUtils
{
private ScriptUtils()
{
}
/**
* Whole string is in quotes, and escape quotes.
*/
public static String shellEscape(String s)
{
StringBuilder buf = new StringBuilder();
buf.append('\'');
for (char c : s.toCharArray())
{
if (c == '\'')
buf.append("'\\''");
else
buf.append(c);
}
buf.append('\'');
return buf.toString();
}
}