var=/a/b/c/d/e.f.g
${var} /a/b/c/d/e.f.g
${var#/*/} b/c/d/e.f.g
${var##/*/ e.f.g
${var%.*} /a/b/c/d/e.f
${var%%.*} /a/b/c/d/e
${var%%/*/ /a/b/c/d/e.f.g
${var%%/*}
${var%b*} /a
${var%%b*} /a
============
<!$>
$ cat file_name
$ vi !$ (last argument from previous command)
$ bzip2 -d file_name.tar.bz2
$ tar xvf !$
$ vi file.txt
$ spell !$
$ mv file.txt /usr/lib/tmac
$ cd !$ (cd /usr/lib/tmac)
$ ls a*
a1 a2 a3
$ rm -f !$ (remove a1 a2 a3)
============
<!:n*>
$ co -l 1171 9845 4598
$ vi !:2* (all arguments from second to the last)
$ vi !* (same as !:1*)
$ !em:2*
============
<^^>
$ cat myflie
cat: myflie: No such file or directory
$ ^li^il (correction)
$ !m:p (for second call previous command, for changing)
$ ^d^d45
$ lpr iueriwur/woeiruuu.c
$ ^uu
============
<!!>
<!:>
$ echo xy
xy
$ !:s/xy/asd
$ !!
echo asd
asd
cat -v foo
!! | more (cat -v foo | more)
!so (command which begins from so)
!?mf (command which has mf part)
!34 (comman #34 from history)
!:0 (only name of the previous command)
$ /usr/bin/grep asd file
$ !:0 sdf file2 (/usr/bin/grep/ sdf file2)
!!:0
$ cat fn fn1 fn2
$ more !:3 (more fn2)
!:2-4
!:-3 (from 0 to 3)
!$ (last argument)
!* (from 1 to end)
!:2- (from 2 to end-1)
!$:r (returns file_name without extention)
$ echo aaa.c asd.c
aaa.c asd.c
$ echo !$:r
asd
$:g (operation is global)
$ x=(a.c b.c c.c)
$ echo $x:gr
a b c
$:e (returns extention of the file)
$ x = (asd.c)
$ echo $x:e
c
!$:t (returns end of path_name)
$ echo /a/b/c
a/b/c
$ echo !$:t
c
$ x=(/a/b/c /d/f/g /e/r/t)
$ echo $x:gt
c g t
$ echo *
f1 f2 f3
$ !:p (prints previous command without executing)
$ echo f1 f2 f3
============
$ history 20
$ fc -l
$ fc 21 23
|