On Fri, Jun 27, 2003 at 09:57:20AM -0700, Richard Crawford wrote:
> I have a script which opens a file, modifies it, and saves the contents to 
> a new file.  The new file must have the same permissions as the 
> original.  The original file is located with the find command:
> 
> fine . -name '*.cfm' -print | while read i
> do
>    # fix the file
>    sed 's#/library#/Library#g' $i > $i.tmp && mv $i.tmp $i
>    chmod <original permissions> $i
> done
> 
> So how can I find out what the permissions of $i are before it's altered, 
> so that I can reset those permissions when the manipulation is complete?

Use GNU chmod:

sol(0) ~ > chmod --help | grep reference
  or:  chmod [OPTION]... --reference=RFILE FILE...
      --reference=RFILE   use RFILE's mode instead of MODE values

Achim
> _______________________________________________
> Solaris-Users mailing list
> [EMAIL PROTECTED]
> http://www.filibeto.org/mailman/listinfo/solaris-users
> 
_______________________________________________
Solaris-Users mailing list
[EMAIL PROTECTED]
http://www.filibeto.org/mailman/listinfo/solaris-users

Reply via email to