- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rm a file named -s
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
тАО12-17-2003 04:20 AM
тАО12-17-2003 04:20 AM
Everything we try sees the filename as a switch.
(I have been doing an 'll' on whatever pattern we try before we'll change the ll to a rm).
Any ideas?
Scott
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 04:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 04:25 AM
тАО12-17-2003 04:25 AM
Re: rm a file named -s
That did it.
Can you explain to me why it works?
Scott
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 04:32 AM
тАО12-17-2003 04:32 AM
Re: rm a file named -s
In all honesty, I can't really explain it. Somehow the -- flag removes the significance of the - flag, which is normally interpreted as an option. Somewhere in the depths of the man pages for the shell it's probably explained but I've never been inspired to search it out.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 05:26 AM
тАО12-17-2003 05:26 AM
Re: rm a file named -s
Another easy way to remove any weirdly named file is to go to that dir & do
rm -i *.*
And answer NO to all files displayed EXCEPT the one you want gone. This will even give you a chance to delete files with nothing but undisplayable chars in their name.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 05:29 AM
тАО12-17-2003 05:29 AM
Re: rm a file named -s
ll -i
in the directory to get the inode value (it will be in the left hand column)
THEN:
find . -inum
Best regards,
Kent M. Ostby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 05:35 AM
тАО12-17-2003 05:35 AM
Re: rm a file named -s
In this case, it would mean tell rm that what follows is not an option, it is the filename.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 05:40 AM
тАО12-17-2003 05:40 AM
Re: rm a file named -s
From man sh-posix:
-- Do not change any of the options; useful in setting parameter 1 to a value beginning with -.
That's what we're doing, setting parameter 1 (the -s) to a value beginning with -.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 06:45 AM
тАО12-17-2003 06:45 AM
Re: rm a file named -s
rm ./-s
You can also make the file with ./
touch ./-s # will create the file....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2003 07:34 AM
тАО12-17-2003 07:34 AM
Re: rm a file named -s
Bill Hassell, sysadmin