2 มีนาคม 2560

Published มีนาคม 02, 2560 by with 0 comment

แปลง Python ไปเป็น shell script ด้วย Sherlock.py

สวัสดีผู้อ่านทุกท่านครับ สำหรับผู้ที่ใช้งาน Linux และ macOS เป็นประจำ คงรู้จัก shell กันเป็นอย่างดี สำหรับใช้สั่งงานโปรแกรม


แล้ว shell script คืออะไร ?

shell script (เชลล์สคริปด์) เป็นไฟล์รวบรวมคำสั่งของยูนิกส์ เป็นอีกภาษาหนึ่งสำหรับเขียนโปรแกรมที่สั่งงานในเชลล์ แต่ด้วยความเก่าของเชลล์สคริปด์ที่พัฒนามานาน ทำให้มีความยุ่งยากในการเขียนเชลล์สคริปด์และอาจมีปัญหาหลาย ๆ อย่างตามาได้ ดังนี้ http://teaching.idallen.com/cst8207/16w/notes/740_script_problems.html

โมดูล Sherlock.py เป็นโมดูลช่วยแปลงโค้ดภาษาไพทอนไปเป็นเชลล์สคริปด์

  • รองรับเฉพาะ Linux และ macOS
  • รองรับทั้ง Python 2 และ Python 3
  • ใช้ MIT License

ติดตั้งได้ด้วยคำสั่ง $ pip install sherlock.py

การใช้งาน
usage: sherlock [-h] [-o output] [-c] [-v] [--version] [file | command]

Python to bash trans-compiler.

positional arguments:
  [file | command]  program read from script file

optional arguments:
  -h, --help        show this help message and exit
  -o output         output file path
  -c, --command     program passed in as string
  -v, --verbose     program run in verbose mode
  --version         show program's version number and exit

อ่านเอกสารได้ที่ https://github.com/Luavis/sherlock.py

0 ความคิดเห็น:

แสดงความคิดเห็น

แสดงความคิดเห็นได้ครับ :)