- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- removing files prefixed with hyphens
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2012 02:02 AM
тАО07-10-2012 02:02 AM
I need to remove some files whose names are prefixed with a (single) hyphen..Although I've read various posts on ways to remove them, I'm still not 100% sure whether the answers provided are all applicable /safe to use under my ( Bourne shell) environment.
An example of one of the files I wish to delete is displayed below....
find . -name '-a'
./-a
/test#
I believe I should be able to delete these files using either of the commands displayed below....but just looking for confirmation that
this will work under the Bourne shell...It would also be useful to know whether the -i (interactive) option will work if included in the commands below ?
rm ./-a
rm -- -a
Solved! Go to Solution.
- Tags:
- leading -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2012 02:32 AM
тАО07-10-2012 02:32 AM
Solution>applicable/safe to use under my (Bourne shell) environment.
(I doubt you are using the Bourne shell on HP-UX. Most likely the Posix shell.)
This problem has nothing to do with the shell. A "-" is not special to the shell.
The problem is with each command and how it parses options and what's an option.
>I believe I should be able to delete these files using either of the commands displayed below but just looking for confirmation that this will work under the Bourne shell..
Why not create a new directory and just try them?
>whether the -i (interactive) option will work if included in the commands below?
Sure, since you are removing one file, not zillions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2012 03:10 AM
тАО07-10-2012 03:10 AM
Re: removing files prefixed with hyphens
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-10-2012 03:18 AM
тАО07-10-2012 03:18 AM
Re: removing files prefixed with hyphens
>Thanks for that.
If you are happy with your answers, please also click on the Kudos start on the post with the answer.