Perl Programming/Keywords/chown

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Previous: chop Keywords Next: chr

The chown keyword[edit | edit source]

chown changes the owner and probably the group of a LIST of files. The first two elements of LIST must be numerical and contain the uid and gid. If one or both of these numbers are equal to -1, this is interpreted on most system that these values are to be left unchanged. Returns the number of successfully changed files.

Syntax[edit | edit source]

  chown LIST

Examples[edit | edit source]

  $cnt = chown $uid, $gid, 'foo', 'bar';
  chown $uid, $gid, @filenames;
Previous: chop Keywords Next: chr