OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 # This alias allows invocations of `python` to work as expected under msys bash. |
| 3 # In particular, it detects if stdout+stdin are both attached to a pseudo-tty, |
| 4 # and if so, invokes python in interactive mode. If this is not the case, or |
| 5 # the user passes any arguments, python will be invoked unmodified. |
| 6 python() { |
| 7 if [[ $# > 0 ]]; then |
| 8 python.exe "$@" |
| 9 else |
| 10 readlink /proc/$$/fd/0 | grep pty > /dev/null |
| 11 TTY0=$? |
| 12 readlink /proc/$$/fd/1 | grep pty > /dev/null |
| 13 TTY1=$? |
| 14 if [ $TTY0 == 0 ] && [ $TTY1 == 0 ]; then |
| 15 python.exe -i |
| 16 else |
| 17 python.exe |
| 18 fi |
| 19 fi |
| 20 } |
OLD | NEW |