Check These Out
you could save the code between if and fi to a shell script named smiley.sh with the first argument as and then do a smiley.sh to see if the command succeeded. a bit needless but who cares ;)
Works for repos cloned via ssh or https.
The coolest way I've found to backup a wordpress mysql database using encryption, and using local variables created directly from the wp-config.php file so that you don't have to type them- which would allow someone sniffing your terminal or viewing your shell history to see your info.
I use a variation of this for my servers that have hundreds of wordpress installs and databases by using a find command for the wp-config.php file and passing that through xargs to my function.
Returns the number of lines in a file, emulates "wc -l" behavior with grep.
This is an example of the usage of pdfnup (you can find it in the 'pdfjam' package). With this command you can save ink/toner and paper (and thus trees!) when you print a pdf.
This tools are very configurable, and you can make also 2x2, 3x2, 2x3 layouts, and more (the limit is your fantasy and the resolution of the printer :-)
You must have installed pdfjam, pdflatex, and the LaTeX pdfpages package in your box.
Curious about differences between /bin, /usr/bin, and /usr/local/bin? What should be in the /sbin dir? Try this command to find out.
Tested against Red Hat & OS X
Define a function
$ vert () { echo $1 | grep -o '.'; }
Use it to print some column headers
$ paste
Next time you are leaching off of someone else's wifi use this command before you start your bittorrent ...for legitimate files only of course.
It creates a hexidecimal string using md5sum from the first few lines of /dev/urandom and splices it into the proper MAC address format. Then it changes your MAC and resets your wireless (wlan0:0).
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Shows all block devices in a tree with descruptions of what they are.