Working filenames in shell begins with a dash character
If you accidently create a file which names begins with a dash (-) character, you'll be realize that you can't simply delete this file with regular rm command:
rm -f -testfile
rm: invalid option -- t
Because of the first character is a dash, shell thinks we want to provide an option to rm commands itself. Solution of this problem is to use double dash character -- after our command's options are finished:
rm -f -- -testfile
it works. When -- character seen, shell thinks that optional arguments for command itself finished and doesn't make option parsing anymore.
- 0 Comment
- Murat Demirten
- 29 Jun 2008, 14:54
-
You must be login first or sign-up for an account to post comments.
Maybe you should look at these also:
USERBOX
CATEGORIES
MOST READ TODAY
- Syntax highlighting in less
- Disabling reverse dns lookups in ssh
- Calculating SHA Checksums
- Enabling remote desktop on a VirtualBox Machine
- Users with /bin/false shell to login on vsftpd
- Redirecting tcp / udp ports with socat
- How to extract a deb package without installing
- Recursively mput with smbclient
- How to record a linux session
- Booting from an ISO image using qemu
LAST ADDED
- Using iPhone internet sharing over bluetooth under Linux
- Using USB sound card with amarok
- Multi-conditional search and replace (clearing a ftp trojan script example)
- Disabling ipv6 functionality
- How to convert a mp3 file
- How to choose the fastest Debian mirror
- Disabling reverse dns lookups in ssh
- Rewriting destination ip address
- Deleting A File By It's Inode Value
- Learning which libraries are used for a binary
