![]() There are two ways to resolve this error as: $ touch -abc.txt To resolve such an error, we have to tell the bash shell not to interpret anything after the special character (here dash), as an option. The reason for the above error is that the shell interprets anything after a dash (-), as an option, and obviously, there is no such option, hence the error. Sample Output: touch: invalid option - 'b' ![]() To work with dashed filenames in Linux, first, create a file that starts with a dash (-), say -abx.txt using the touch command. These filenames can sometimes cause issues when working with them because the leading dash can be misinterpreted as an option or flagged by command-line utilities. In Linux, filenames that begin with a dash ("-") are often called “ dashed filenames” or “ hyphenated filenames“. Also speaking technically every thing be it a folder, driver, or anything else is treated as a file in Linux. I agree with you, that such file names are not common still your shell should not break/give up when you have to deal with any such file names. One of the most obvious questions here is – who on earth create/deal with files/folder name having a Hash (#), a semi-colon ( ), a dash (-) or any other special character. Special Characters in Filenames in LinuxĮxamples of the most common file names are: abc.txtĮxamples of numeric file names are: 121.txtĮxamples of Alpha-Numeric file names are: eg84235.txtĮxamples of file names that have special character and is not very common: #232.txt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |