Archive

Archive for the ‘bash’ Category

unfuddle – git repository, I don’t want to type in my passphrase on each commit

June 25, 2011 Leave a comment

Want to push changes to a remote git repo, but don’t want to enter in your passphrase every time? This example is on ubuntu.

  1. eval `ssh-agent`
  2. ssh-add ~/.ssh/id_rsa

    Add the private key

ssh-agent:
http://www.symantec.com/connect/articles/ssh-and-ssh-agent

Advertisements
Categories: bash, Linux Tags:

Recursively remove all .svn directories

June 24, 2011 Leave a comment
find . -name .svn -print0 | xargs -0 rm -rf
Categories: bash

beautiful shell script – rename files with paths – man find

December 21, 2007 5 comments

I’m in the process of converting a MCMS generated site over to php / unix environment and was suffering from the “default.htm” problem. So I needed to copy all the default.htm files to index.htm. Was sitting there playing with some shell scripting for a minute and then found this GREAT link: awesome one-liner:

for f in `find . -name '*replaceme.jpg'` ; do mv $f ${f/replaceme/withme}; done

Ok, so I had to see how this thing works… I’ve used bash for several years and never saw this ${f/x/y} syntax.. looking at the bash reference guide, it looks like “shell parameter expansion”. Very convenient.. if only I had read the manual sooner….