Skip to main content

[bash] cd đến thư mục vừa tạo

hvn@hvnatvcc: ~ $ mkdir -p hello/this/is/familug/dot/org
hvn@hvnatvcc: ~ $ cd !$
cd hello/this/is/familug/dot/org
hvn@hvnatvcc: ~/hello/this/is/familug/dot/org $ pwd
/home/hvn/hello/this/is/familug/dot/org

!$ là `yank-last-arg`


từ man bash:

       yank-last-arg (M-., M-_)
              Insert  the  last argument to the previous command (the last word of the previous history entry).  With a numeric argument, behave exactly like yank-nth-arg.  Successive calls to yank-last-arg move back through the history list, inserting the last  word  (or  the  word  specified  by the argument to the first call) of each line in turn.  Any numeric argument supplied to these successive calls determines the direction to move through the history.  A negative argument  switches  the  direction through  the  history (back or forward).  The history expansion facilities are used to extract the last argument, as if the "!$" history expansion had been specified.

Comments

  1. dạo này dùng lệnh này cực kỳ nhiều :D

    ReplyDelete

Post a Comment

Popular posts from this blog

Tài liệu và hướng dẫn học Python

Để tiết kiệm thời gian, tốt nhất là đi học PyMI Updated: 130617 Sau đây là các tài liệu khuyên dùng: Vì nhiều lý do, nên học python2.7 tại thời điểm hiện tại (giờ là tháng 6/2013 - muốn biết tại sao thì tự tìm hiểu) python 3.5+ (giờ là tháng 2/2017) Chuẩn bị: 1. biết bật tắt máy 2. biết cài python 3. tập gõ 10 ngón - gõ 2 ngón hay 1 ngón cũng không sao, nhưng 10 ngón là cách dễ nhất để gõ nhanh nhất. Tài liệu - Nên dùng tài liệu tại trang chủ của Python làm chính, tham khảo thêm các tài liệu khác tại http://www.familug.org/2016/12/free-ebook.html Căn bản, mới học 1.1 Python PyMI.vn https://pymi.vn/tutorial/ 1.2. Python offical tutorial kết hợp làm bài tập trên HackerRank  (đề bài bằng tiếng Anh, nhưng Google translate 1 lúc cũng ra vì có nhiều ví dụ mẫu đi kèm). Học viên của Pymi.vn có rất nhiều học viên đã tự học với Learn Python the hard way nhưng chưa thấy ai thành công cả. Hai link dưới nên đọc sau khi đã nắm được những phần cơ bản của ngôn ngữ pytho...

The PyMiers

New FAMILUG