Since you can’t really pass pointers or references to arrays and you can’t return anything other than integers, here’s how to implement push, pop, shift, and unshift in a bash shell script. I don’t know if this already exists in bash, but I couldn’t find it and I needed a data structure in a hurry.
It’s hard to believe X has been around since 1985. Most people expect all applications to use X, and modern Linux operating systems seem to be reimplementing all kinds of applications to incorporate graphical interfaces. The combination of layers available when developing an application that uses X is staggering.
ver wish you could test your code on a machine that’s not connected to teh interwebs and doesn’t have python installed? I like portable applications for many reasons, mainly because they just work.
nstallation is easy. Just put the .vim file in ~/.vim/after/ftplugin/ and put the dictionary file somewhere else. Then add two lines to your .vimrc and that’s it. Just hit tab and it will give you a drop down menu allowing you to auto-complete if your cursor is sitting just after a keyword.
Everything you ever wanted to know about the stream editor sed. Pattern matching, delimiters, deletion, ranges, grouping, all explained.
In almost all high level languages you can do something similar to x++ to increment an integer counter. Bash doesn’t have an incrementer, but you can still make your own integer counter using back-ticks and expr.
Start the spec file with %define statements at the top. Continue the spec file as you would normally, using the variables you just defined in place of the real name, version, build. Create an rpmbuild script that replaces the template variables with current information. Make an rpm target in your Makefile that calls the rpmbuild script.
Change lowercase to uppercase or vice versa using sed the brute force easy way and the smart way. One use of this would be finding the hardware address of an interface and converting it to all uppercase.
This one should be pretty bulletproof. Use a single sed command to dump the list of all ip addresses from interfaces showing in ifconfig.
99% of the time you can just use the local address to talk to yourself. This is just an example to show you how wrangle the ip address using awk. Rewrite the hosts file so the host itself can use it’s external address by name. Write out the basic stuff in hosts that doesn’t change then write out the current IP address.