private String formatProperty(String fieldKey, String fieldValue) {
        if (!safe) {
            // Remove whitespace from name and quotes the value.
            // This typically still returns bash-unsafe key-value pairs.
            return fieldKey + "=" + fieldValue;
        } else {
            // This returns bash-safe variables.
            // First, we remove any illegal characters
            fieldKey = fieldKey.replaceAll("[^a-zA-Z0-9_]+", "_");
            // In case the variable name is starting with a digit, we add in an underscore instead.
            if (fieldKey.matches("^[0-9].*$")) {
                fieldKey = "_" + fieldKey;
            }
            // All return characters should be escaped for bash
            fieldValue = fieldValue.replaceAll("\\n", "\\ \n");
            return fieldKey + "='" + fieldValue + "'";
        }
    }