Recent Blog Posts
When automating mysqldump it is necessary to pass authentication information along with the command. While you can pass the credentials on the command line this is considered unsafe as the password would be visible to all users using the ps afx command (for example).
A workaround for this is using expect a program that is meant to automate user interaction for terminal programs. IT simulates a tty and passes input to the controlled program depending on its output.
Remove all packages from a pear channel
Dezember 20th, 2012 Read more ...
The PEAR installer has no option to remove all packages from a channel at once. So I’ve crafted a small shell script for that task:
#!/bin/bash
CHANNEL_NAME="THE NAME"
for pkg in $(pear list -c "$CHANNEL_NAME" \
| awk '{if ( $2 ~ /([0-9]+)\.([0-9]+)\.([0-9]+)/ ) print $1}') ; do
pear uninstall "$CHANNEL_NAME/$pkg"
done
Export a linux binary with its lib dependencies to a chroot or initramfs, …
November 9th, 2012 Read more ...
Sometimes it is nessesary to copy a Linux binary with its lib dependencies to a folder or archive. For example when creating an chroot emvironment, create an initramfs or copy a binary from one machine to another with the same architecture and kernel interface (this is hacky, yes)
Because I frequently needed to do this, I wrote a small shellscript for that purpose. Here comes the shellscript, explanation will follow ...
Reverse ARP in a shell script
Juli 11th, 2010 Read more ...
Sometimes it is useful in bash scripts to resolve an IP address to a mac address. Here comes a simple script that perfroms this action: