Operating System - HP-UX
1753731 Members
4689 Online
108799 Solutions
New Discussion юеВ

Re: Creation of directory with special name on HP-UX

 
SOLVED
Go to solution
Shivkumar
Super Advisor

Creation of directory with special name on HP-UX

Hi,

I was trying to create subdirectores rose/pink under /some/directory using command as below:

mkdir -p /some/directory/rose/pink as a powerbroker user.

The directory /some/directory has alread been used by some running Applications.

It failed to create the rose/pink. Then i went to /some/directory and issued the command mkdir -p rose/pink.

It worked this time. However, i saw a directory with special name -p got created under /some/directory.

Can anyone explain how come this directory with special name got created ?

Thanks,
Shiv
8 REPLIES 8
James R. Ferguson
Acclaimed Contributor
Solution

Re: Creation of directory with special name on HP-UX

Hi Shiv:

> It failed to create the rose/pink.

I would expect that unless you either specified '-p' with rose/pink or did a 'mkdir rose'; 'cd rose && mkdir pink'.

> Then i went to /some/directory and issued the command mkdir -p rose/pink.

OK, that's the easy way.

> It worked this time. However, i saw a directory with special name -p got created under /some/directory. Can anyone explain how come this directory with special name got created ?

I strongly suspect that you first inverted the arguments so that you had:

# mkdir -p rose/pink -p

(or something like that)

You could look at your 'sh_history' if it still exists.

To remove the errant directory name, do:

# rm -- -p

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: Creation of directory with special name on HP-UX

HI (again) Shiv:

OOPS!

To remove the errant directory name, do:

# rmdir -- -p

Regards!

...JRF...
Shivkumar
Super Advisor

Re: Creation of directory with special name on HP-UX

Is it possible that application pr process might have locked directory "/some/directory/" and that is the reason it failed to create with the command:

$mkdir -p /some/directory/rose/pink
Patrick Wallek
Honored Contributor

Re: Creation of directory with special name on HP-UX

Not likely.

I agree with JRF in that you may have mistakenly done something like 'mkdir /some/directory/rose/pink -p' rather than 'mkdir -p'.

Check your powerbroker logs to see what it recorded exactly.
Shivkumar
Super Advisor

Re: Creation of directory with special name on HP-UX

I usually never type commands if it is a part of some install guide and i need to execute in production. I just copy and paste on terminal. That way i avoid typo mistake.

Secondly, i tried to create a directory with the name -p under my home directory but i could not probably because -p is a directory with special character.

Is there any specific command if i need to use to create directory having special character say -p in this case ?
James R. Ferguson
Acclaimed Contributor

Re: Creation of directory with special name on HP-UX

Hi Shiv:

> I usually never type commands if it is a part of some install guide and i need to execute in production. I just copy and paste on terminal. That way i avoid typo mistake.

Unless you paste more than once :-)

> Secondly, i tried to create a directory with the name -p under my home directory but i could not probably because -p is a directory with special character. Is there any specific command if i need to use to create directory having special character say -p in this case ?

But of course! Do:

# mkdir -- -p

The double dash tells well-behaved utilities that there are no more switches and that the remainder of the argument list are arguments.

Thus, having created the directory named '-p' with the above, remove it with:

# rmdir -- -p

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Creation of directory with special name on HP-UX

>JRF: mkdir -- -p

You can also use the tried and true:
mkdir ./-p
Steven E. Protter
Exalted Contributor

Re: Creation of directory with special name on HP-UX

Shalom Shiv,

Is there a mistake to be found in the history output or the .sh_history or whatever file you have HISTFILE pointed at.

I can add that I've gotten the same results once or twice was ready to call the response center and/or post results to ITRC and the keyboard history contradicted what I thought I'd done.

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