Archive for January, 2008

Unbeknownst to many, rpm supports random printf() style query strings via the –qf option. List all available tags with “rpm –querytags” and display them with “rpm -q –qf ‘%{QUERYVARIABLE}’. On some versions of rpm, you need to place multiple variables inside brackets ( [] ) to display them all properly.
Use the ARCH and NAME tags […]

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 […]





View Jeff Schroeder's profile on LinkedIn
All content (c) 2008 Jeff Schroeder