It's funny how a quickly hacked up script of a dozen lines can become so much a part of your everyday routine that you feel like a complete klutz when you have to do without it. (One reason I now carry a usb key around with my ~/bin on it). Take the following for example..
#!/bin/bash
PWD=`pwd`
TOP=`basename $PWD`
if [ -f $1~ ]; then
rm -f $1~
fi
cp $1 $1~
$EDITOR $1
cd ..
diff -up $TOP/$1~ $TOP/$1 >>$TOP/current.diff
I call this 'kwikdiff'. When I want to create a kernel patch I do for example..
kwikdiff mm/swapfile.c
This then fires up editor of choice, and when I save after making my modifications, it creates a current.diff in the dir I started in. Subsequent file edits make further additions to the current.diff
The amount of time this script has saved me from copying trees/links/running diff etc is something I wouldn't like to even guess at.
It's invaluable to me for firing off little quick one-liners.
I've got a whole bunch of handy scripts like this in my ~/bin. Sometimes I wonder how folks live without such scripts. Then I figure that everyone else must have a bunch of handy scripts too. Which gets me wondering, what cool tricks do they have in their ~/bin/'s that they aren't sharing :-)
#!/bin/bash
PWD=`pwd`
TOP=`basename $PWD`
if [ -f $1~ ]; then
rm -f $1~
fi
cp $1 $1~
$EDITOR $1
cd ..
diff -up $TOP/$1~ $TOP/$1 >>$TOP/current.diff
I call this 'kwikdiff'. When I want to create a kernel patch I do for example..
kwikdiff mm/swapfile.c
This then fires up editor of choice, and when I save after making my modifications, it creates a current.diff in the dir I started in. Subsequent file edits make further additions to the current.diff
The amount of time this script has saved me from copying trees/links/running diff etc is something I wouldn't like to even guess at.
It's invaluable to me for firing off little quick one-liners.
I've got a whole bunch of handy scripts like this in my ~/bin. Sometimes I wonder how folks live without such scripts. Then I figure that everyone else must have a bunch of handy scripts too. Which gets me wondering, what cool tricks do they have in their ~/bin/'s that they aren't sharing :-)
