- 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
Forums
Discussions
Discussions
Discussions
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 09:28 AM
12-17-2003 09:28 AM
Re: rm a file named -s
wont your rm fail with files, that start with a dot? The safest method of course is the method to find out the inode number and then with find delete it. I wonder, if rm \-s works too.
have fun,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 09:40 AM
12-17-2003 09:40 AM
Re: rm a file named -s
I guess I fat-fingered that & didn't notice it was supposed to be
rm * .*
So that .-leading files would be tagged as well.
The spaces are SO hard to see in the forum now.
Cheers,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 09:42 AM
12-17-2003 09:42 AM
Re: rm a file named -s
rm -i * .*
SEE how hard that space is to see & padding it with more & they get dropped I think - let's test:
rm -i * .*
Later,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 09:43 AM
12-17-2003 09:43 AM
Re: rm a file named -s
Later,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2003 02:54 PM
12-17-2003 02:54 PM
Re: rm a file named -s
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2003 04:57 PM
12-18-2003 04:57 PM
Re: rm a file named -s
It is forbidden to remove the file .., in order to avoid the consequences of using a command such as:
rm -r .*