Operating System - HP-UX
1753287 Members
5530 Online
108792 Solutions
New Discussion юеВ

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

 
Jerry Jiangwei
Advisor

How to `mkdir' a directory, whose privileges are same the existing direcotry

Hi forks,

I would like to implement the following functions in HP-UX,

# ll -d /foo/

and I would like to do `mkdir /tmp/foo', whose privileges and owner/group are same with /foo

How can I do that?

Thanks
-- Jerry
3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

Shalom Jerry,

Few ways.

1) Set the umask to the default that causes creation to be the correct. That is the simple way.
2) Have your script change permissions after creation
3)Create a situation where the mkdir is a subdirectory of a master directory and use chmod 3### (### are numbers) to create a parent child relationship concerning permissions.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jerry Jiangwei
Advisor

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

Hello Steven E. Protter ,

Thanks for your help, but if you notice the
sign `#', that mean I am the superuser and have a root privilege,

So what I want is,
# ll -d /dev
dr-xr-xr-x 13 bin bin 8192 Jan 10 01:53 /dev

and I want to mkdir in /tmp/dev/, which mode are set to same as the real one /dev/

-- Jerry
Dennis Handly
Acclaimed Contributor

Re: How to `mkdir' a directory, whose privileges are same the existing direcotry

>which mode are set to same as the real one /dev/

See my permission copying scripts in this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1215123