Subject: Re: mergemaster
To: Martti Kuparinen <>
From: Jeremy C. Reed <>
List: current-users
Date: 11/14/2001 09:58:12
On Wed, 14 Nov 2001, Martti Kuparinen wrote:

> I've written a FreeBSD mergemaster-like utility to compare, merge and
> install files into /etc (from /usr/src/etc). Yes, I've read the previous
> "wars" on this subject but I needed a tool to do the config file update...
> This script does NOT check for any CVS tags but runs cmp to find out
> if the file has been updated in /usr/src/etc or not. And if it has,
> the user gets a diff and possibility to merge the currently installed
> and the new version, see the merged version and finally install it.

Also, have a look at my
and J. McNeill's

> And now the question: how should I get a file's permission in a
> /bin/sh script? I don't want to make this script depend on perl but if
> possible use only standard tools like ls, sed and awk.The uid and gid
> are easily retrieved from ls output but I'd like to avoid parsing the
> "-rwxr-xr-x" strings to produce octal number. But can it be avoided?

I am curious, what do you need this for?

I've been think the past month or more that it would be good to either add
options to ls(1) or chmod(1) to output the current file modes in octal or
create another simple tool to do it. It really seems like some stat(1)
tool should exist that could be used like:

 $ stat -mn /etc/passwd
 $ stat -m /etc/rc.d
 /etc/rc.d : 40755

> All comments are welcome: especially permission parsing and suggestion
> for the name. I'll upload this script somewhere when I'm home (I'm on
> business trip right now).

I look forward to seeing your script.

   Jeremy C. Reed