New escape_bash_quotes function.

Change-Id: I7a05585b7aca3e94379db51ef8b9e3a830143adc
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_misc.py b/lib/gen_misc.py
index 65ab0b4..dc2f36f 100755
--- a/lib/gen_misc.py
+++ b/lib/gen_misc.py
@@ -274,6 +274,30 @@
     return PATH_LIST
 
 
+def escape_bash_quotes(buffer):
+
+    r"""
+    Escape quotes in string and return it.
+
+    The escape style implemented will be for use on the bash command line.
+
+    Example:
+    That's all.
+
+    Result:
+    That'\''s all.
+
+    The result may then be single quoted on a bash command.  Example:
+
+    echo 'That'\''s all.'
+
+    Description of argument(s):
+    buffer                          The string whose quotes are to be escaped.
+    """
+
+    return re.sub("\'", "\'\\\'\'", buffer)
+
+
 def quote_bash_parm(parm):
 
     r"""