changeset 5:f5a63edf4c98 draft

Use silly trick to execute from /tmp/cmd so that we can pass shopts to bash
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Wed, 25 Sep 2013 14:00:57 -0400
parents 91ff6ba9d825
children 15620df00023
files sh-replay
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sh-replay
+++ b/sh-replay
@@ -77,13 +77,16 @@
                 sys.stdout.write("\n")
                 sys.stdout.flush()
                 break
+
         if cmd.startswith("cd "):
             cd(cmd[3:])
         else:
-            subprocess.call(cmd, shell=True, executable="/bin/bash")
+            with open("/tmp/cmd", "w") as f:
+                f.write("shopt -s expand_aliases\n")
+                f.write(cmd + "\n")
+                f.flush()
 
-        sys.stdout.write("\n")
-        sys.stdout.flush()
+            subprocess.call(["/bin/bash", "-l", "/tmp/cmd"])
 
 if __name__ == "__main__":
     main()