Brace expansions save you lots of typing:
$ ls
file1
$ cp file{1,2}
$ ls
file1 file2
$ mv file{1,1.old}; ls
file1.old file2
You can even use brace expansions in shell scripts:
#!/bin/bash
scp /path/to/{file1,dir2,file2} user@otherserver:/dump/
if [ $? -eq 0 ]; then
rm /path/to/{file1,dir2,file2}
fi
NOTE: In posix land, an exclamation mark is often referred to as a "bang".
!! - aka "bang bang". Runs the previous command typed into the shell
!vi - Runs the most previous command starting with "vi"
!?passwd - Runs the most previous command that contained "passwd"
!vi:p - Prints the most previous command containing "vi" without running anything.
!vi:s/passwd/shadow/ - Runs the most previous command containing the word "vi" and replaces "passwd" with "shadow"
{ 0 comments… add one now }