Re: 'Inverse' chmod?
On Thu, Jul 15, 1999 at 04:47:26PM -0400, Bob Bernstein wrote:
> Carl Mummert <mummert@cs.wcu.edu> wrote:
>
> > perl -e 'printf "%#o", ((stat("FILENAME"))[2] & 0x1ff)'
>
> Great!
>
> It works fine from the command line, but I tried it in a shell script with no
> luck.
>
> #! /bin/bash
> perl -e 'printf "%#o", ((stat($1))[2] & 0x1ff)'
what do you mean, no luck? what was the error message? anyway, you
should try
#! /bin/bash
/usr/bin/perl -e 'printf "%#o", ((stat($1))[2] & 0x1ff)'
or whatever 'which perl' tells you.
putting a perl command in a shell script seems silly though... why not
just use
#!/usr/bin/perl
printf "%#o", ((stat($ARGV[0]))[2] & & 0x1ff);
--
Michael Stenner Office Phone: 919-660-2513
Duke University, Dept. of Physics mstenner@phy.duke.edu
Box 90305, Durham N.C. 27708-0305
Reply to: