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.
USERBOX
CATEGORIES
MOST READED TODAY
- Creating splitted rar archive files
- XFS Filesystem has duplicate UUID problem
- Solving ssh problems
- Converting MAC dfonts to TrueType
- Changing time in Linux
- Listing files by size
- Search and replace on multiple files
- Passwordless sudo setup
- Using lsof utility
- Remove comments and blank lines from files
LAST ADDED
- Routing packets back from incoming interface
- Users with /bin/false shell to login on vsftpd
- Redirecting TCP ports with redir
- Assembly code of a C code
- Network interface status with mii-tool
- dropbear rsa key problem
- Displaying disk io statistics
- Disabling ssh password authentication
- Creating splitted rar archive files
- Creating self-extracting zip archives for both Linux and Windows
