String shellQuote(String value) { if (value.isEmpty) { return "''"; } return "'${value.replaceAll("'", "'\"'\"'")}'"; }