Skip to main content
Memanggil history (bahagian II)

Pada siri yang lalu kita telah mempelajari bagaimana untuk memanggil baris arahan mengikut jujukan nombor pada history.

Kali ini kita menggunakan awalan huruf/rangkai kata pada history.


Katakan kita melaksanakan 3 ARAHAN iaitu echo $PATH, cat /proc/version dan date

$ echo $PATH
/usr/local/sbin:/usr/local
/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

$ cat /proc/version
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009

$ date
Rab Ogos 12 12:42:56 MYT 2009


Rekodnya...

$ history
1 echo $PATH
2 printenv
3 echo $PATH
4 cat /proc/version
5 date
6 history

Kita cuba cara yang lalu... menggunakan baris pada kolum nombor
$ !1 && !5 && !4
echo $PATH && date && cat /proc/version
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Rab Ogos 12 12:43:15 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009

Cuba guna awalan huruf pada arahan... rujuk "history" di atas.. "
$ !e && !d && !c
echo $PATH && date && cat /proc/version && date && cat /proc/version
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Rab Ogos 12 12:43:36 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009
Rab Ogos 12 12:43:36 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009



:-)

Comments

Popular posts from this blog

Gue dengan S2 gue. Sronok banget!
Beijing and image manipulation addict Salam, Image manipulation with command line is fun and time consuming too. Given my Digikam plugins unable to work, I start to figure out many wonderful features of other tool which offer almost the same quality. However I was stucked with ImageMagick,with many tutorial on the net: Here and Here for i in *jpg ;do convert -font helvetica -fill white -pointsize 18 -draw 'text 10,50 "ACM-ICPC Beijing 2005"' $i $i;done The pix above shows a heater to heat up guest room during ACM-ICPC competition. (outside building's temperature is almost 4 celcious).