Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Sunday, April 22, 2012

BASH directory recursion, scope and local variables

How quaint, I am using a bash shell script to do backups of my data, very similar to time machine if anyone is familiar.  Not sure why shell, at this point I can count on so many other things to be included, but I chose shell.  My directory recursion was failing after a few loops and I could not figure out why, until I found out that bash does not do lexical scope very well, and local variables need to be declared as local explicitly.  This way when a recursive invocation exits it's assignments will not live on.

Thursday, March 1, 2012

HP-UX getent

I spent quite a bit of time looking for a getent equivalent for HP-UX.  I needed something that would return a non zero value if a user or a group I queried were not there.  In case you are having as much fun as I am, the commands are pwget and grget