This is G o o g l e's cache of http://www.debianclub.com/node/52 as retrieved on 16 Feb 2007 19:17:47 GMT.
G o o g l e's cache is the snapshot that we took of the page as we crawled the web.
The page may have changed since that time. Click here for the current page without highlighting.
This cached page may reference images which are no longer available. Click here for the cached text only.
To link to or bookmark this page, use the following url: http://www.google.com/search?hl=en&q=cache%3Ahttp%3A%2F%2Fwww.debianclub.com%2Fnode%2F52&btnG=Search


Google is neither affiliated with the authors of this page nor responsible for its content.

User login

Links

debianclub.com
debian.org
ubuntuclub.com
blognone.com

Syndicate

Syndicate content

Bash Auto Completion

|

bash (Bourne-again shell) เป็น shell หนึ่งใน GNU Project ที่เป็นที่นิยมใช้กันมากที่สุดในปัจจุบัน และเป็น default shell ใน linux distribution หลายๆ ตัว รวมทั้ง debian ด้วย สำหรับ auto completion ก็เป็นจุดเด่นนึงของ bash การใช้ก็แค่กดปุ่ม TAB เพื่อช่วยให้คำสั่งหรือ path ครบถ้วนถูกต้อง เพิ่มความสะดวก เหมาะสำหรับคนขี้เกียจพิมพ์และยังช่วยป้องกันการพิมพ์ผิดได้เป็นอย่างดี

ดังตัวอย่าง

apti[TAB]

ก็จะได้ aptitude

หรือ

apt[TAB][TAB]

ก็จะแสดงคำสั่งที่ขึ้นต้นด้วย apt

นอกจากนี้ก็ยังใช้กับ path ได้ด้วยเช่น

ls /ho[TAB]

นอกจากนี้เราสามารถใช้ auto completion กับ option หรือ parameter ของคำสั่งต่างๆ เช่น aptitude, apt-get, dpkg, svn, cvs, openssl ฯลฯ ได้ด้วย แต่ต้องเปิดการทำงานนั้นก่อนโดยคำสั่ง

. /etc/bash_completion

แล้วทีนี้ก็ลอง

apti[TAB] in[TAB] ชื่อpackage

ทั้งนี้ชื่อ package ก็สามารถใช้ TAB ได้ด้วย เห็นมั้ยครับว่าสะดวกมากเลย หากต้องจะใช้ความสามารถนี้ทุกครั้งที่ login ก็เพิ่มบรรทัดเหล่านี้เข้าไปยัง ~/.bashrc

if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi

ถ้าจะเปิดให้กับทุก user ก็เอาไปใส่ใน /etc/profile แต่จะให้ได้ผลใช้กับ screen ตามบทความก่อนหน้านี้ ก็ให้ไป uncomment ใน /etc/bash.bashrc ซึ่งจะอยู่ท้ายสุดของไฟล์

รายละเอียดลึกๆ ลองศึกษาจากเว็บอ้างอิงนะครับ

Reference


ว้าว ....

ใช้กับ parameter ได้ด้วย เพิ่งรู้ว่ามีอย่างนี้ด้วย

ขอบคุณมากครับ

**********************
Key ID: D4CEFD37
Fingerprint: 1ED3 27F6 48C8 5C9D 4285 F24D D64E C0AF D4CE FD37
**********************

เพิ่งทราบ *-*

แหม เพิ่งรู้ว่าใช้กับ parameter ได้ด้วย ดีจริง ๆ
ขอบคุณมากครับ