Posts by Category

Buttons

Pure New Zealand

This site is driven by Blosxom

T
his site was written in vi

SDF is driven by NetBSD

Subscribe to this sites RSS/XML feed

This site has a Tableless Stylesheet

Email me

May 17, 2006

Shell Bang Commands

Reproduced as a handy reference. Originally the work of Kevin Lyda and posted to the ILUG mailing list.

For the purposes of these tips, every tip will assume these are the last
three commands you ran:
    % which firefox
    % make
    % ./foo -f foo.conf
    % vi foo.c bar.c
Getting stuff from the last command:
    Full line:     % !!            becomes:   % vi foo.c bar.c
    Last arg :     % svn ci !$     becomes:   % svn ci bar.c
    All args :     % svn ci !*     becomes:   % svn ci foo.c bar.c
    First arg:     % svn ci !!:1   becomes:   % svn ci foo.c
Accessing commandlines by pattern:
    Full line:     % !./f          becomes:   % ./foo -f foo.conf
    Full line:     % vi `!whi`     becomes:   % vi `which firefox`
    Last arg :     % vi !./f:$     becomes:   % vi foo.conf
    All args :     % ./bar !./f:*  becomes:   % ./bar -f foo.conf
    First arg:     % svn ci !vi:1  becomes:   % svn ci foo.c

Permalink | 2006.05.17-02:57.00