• DocumentCode
    700399
  • Title

    Bash2py: A bash to Python translator

  • Author

    Davis, Ian J. ; Wexler, Mike ; Cheng Zhang ; Holt, Richard C. ; Weber, Theresa

  • Author_Institution
    David Cheriton Sch. of Comput. Sci., Univ. of Waterloo, Waterloo, ON, Canada
  • fYear
    2015
  • fDate
    2-6 March 2015
  • Firstpage
    508
  • Lastpage
    511
  • Abstract
    Shell scripting is the primary way for programmers to interact at a high level with operating systems. For decades bash shell scripts have thus been used to accomplish various tasks. But Bash has a counter-intuitive syntax that is not well understood by modern programmers and is no longer adequately supported, making it now difficult to maintain. Bash also suffers from poor performance, memory leakage problems, and limited functionality which make continued dependence on it problematic. At the request of our industrial partner, we therefore developed a source-to-source translator, bash2py, which converts bash scripts into Python. Bash2py leverages the open source bash code, and the internal parser employed by Bash to parse any bash script. However, bash2py re-implements the variable expansion that occurs in Bash to better generate correct Python code. Bash2py correctly converts most Bash into Python, but does require human intervention to handle constructs that cannot easily be automatically translated. In our experiments on real-world open source bash scripts bash2py successfully translates 90% of the code. Feedback from our industrial partner confirms the usefulness of bash2py in practice.
  • Keywords
    authoring languages; operating systems (computers); program compilers; public domain software; Bash; Bash2py; Python; counter-intuitive syntax; human intervention; industrial partner; internal parser; memory leakage problems; open source bash code; operating systems; shell scripting; source-to-source translator; Computer languages; Manuals; Open source software; Programming; Runtime; Syntactics; Bash; Python; open-source; scripting; translation;
  • fLanguage
    English
  • Publisher
    ieee
  • Conference_Titel
    Software Analysis, Evolution and Reengineering (SANER), 2015 IEEE 22nd International Conference on
  • Conference_Location
    Montreal, QC
  • Type

    conf

  • DOI
    10.1109/SANER.2015.7081866
  • Filename
    7081866