Created
September 14, 2018 13:43
-
-
Save iancclark/a1283c7e090b753203fa0821f8461130 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
my $change=0; | |
my %uids=( | |
1234=>4567, | |
); | |
my %gids=( | |
5432=>2345, | |
); | |
my (undef,undef,undef,undef,$uid,$gid,undef,undef) = stat($ARGV[0]); | |
if(defined($uids{$uid})) { | |
$uid=$uids{$uid}; | |
$change=1; | |
} | |
if(defined($gids{$gid})) { | |
$gid=$gids{$gid}; | |
$change=1; | |
} | |
if($change==1) { | |
chown $uid, $gid, $ARGV[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment