Sometimes you maybe have to handle files with a dash (-) as first character from Linux command line. It can be difficult, because the script “thinks” the marks after the dash are parameters.
So files which name begins with dash (-) can not be dealt with directly by typing the command and the file name, such as the following:
Files which name begins with dash (-) can be used as follows:
Create a file named “-test”:
Add some content to “-test” file:
echo "test content to file" > ./-test
View “-test” file content:
Delete “-test” file: