Post thumbnail of Two ways to change case lowercase to uppercase using sed
22 June 2010
Continue reading Two ways to change case lowercase to uppercase using sed

Two ways to change case lowercase to uppercase using sed

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.

Post thumbnail of Bash One-liner to get IP address for each network interface
15 June 2010
Continue reading Bash One-liner to get IP address for each network interface

Bash One-liner to get IP address for each network interface

This one should be pretty bulletproof. Use a single sed command to dump the list of all ip addresses from interfaces showing in ifconfig.

Post thumbnail of Use awk to figure out your ip address from ifconfig for a bash script
3 June 2010
Continue reading Use awk to figure out your ip address from ifconfig for a bash script

Use awk to figure out your ip address from ifconfig for a bash script

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.

Post thumbnail of Longest dumbest bash command ever
7 May 2010
Continue reading Longest dumbest bash command ever

Longest dumbest bash command ever

What would I do without the Linux shell? The sheer number of mouse clicks required to do this in Windows would result in instant and painful arthritis. For each Makefile in any child directory below pwd, It’s looking for a broken include string where the include was specified after the library and if it finds this case, it rewrites that part so it’s include/library. It’s basically the same thing done over and over for each include that might exist in any Makefile.

Post thumbnail of Use multiple processors in bash by running commands in parallel
15 January 2010
Continue reading Use multiple processors in bash by running commands in parallel

Use multiple processors in bash by running commands in parallel

Here’s a short bash script to parallelize your jobs. There are utilities already written for just this type of thing, but forget xargs. Check out xjobs instead.

Post thumbnail of Build script to utilize Makefiles to build multiple applications
29 December 2009
Continue reading Build script to utilize Makefiles to build multiple applications

Build script to utilize Makefiles to build multiple applications

You have a bunch of related applications, each has their own Makefile that knows only about their own application, but you have dependencies where one app needs to be built before another. Here’s a skeleton bash script for building any one thing or everything.

#!/bin/bash

function build {
echo "*** …

Post thumbnail of Running bash shell scripts in debug mode to trace execution
26 August 2009
Continue reading Running bash shell scripts in debug mode to trace execution

Running bash shell scripts in debug mode to trace execution

This is so handy, I can’t believe i’ve never used or even heard of this until today! You can easily run your bash shell scripts in debug mode to watch what they’re doing behind the scenes in real time. You get to see the levels of nesting when you’re inside loops and variables get replaced with their actual contents at the time of execution.
This might come in handy if you have multiple levels of nesting in ‘for’ and ‘while’ loops or a few if/then/else statements and you want to see just what is getting passed in the comparisons.

Post thumbnail of Looping over a range in bash
7 April 2009
Continue reading Looping over a range in bash

Looping over a range in bash

I don’t know why I always forget how to do ranges, but I do. I guess it has something to do with the fact that I don’t expect it to be like C at all, and I don’t need to use it often enough to remember.

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Post thumbnail of Command line shortcut #977 - shell auto-completion
18 February 2009
Continue reading Command line shortcut #977 - shell auto-completion

Command line shortcut #977 - shell auto-completion

Instead of typing the export string out each time and the emerge line too, I just recalled them from the history knowing that the last set of commands that started with those characters were the commands I wanted. If you didn’t know about these handy shortcuts, now you know, and knowing is have the battle. So when is that movie coming out anyway!!?

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Post thumbnail of shc compiler to compile bash shell scripts into binary
8 January 2009
Continue reading shc compiler to compile bash shell scripts into binary

shc compiler to compile bash shell scripts into binary

shc is the only tool i’ve found that will compile scripts so idle hands won’t tamper with your bash shell scripts. Yes, I know I could just use permissions to keep people from reading them and it’s easy to reverse engineer the binary code, but I look at it like …

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
 Page 1 of 2  1  2 »
Powered by Wordpress   |   Lunated designed by ZenVerse