How can you create a file named –i? Which techniques do not work, and why do they not work? How can you remove the file named –i?

What will be an ideal response?

Most utilities assume –i is an option, not the name of a file, and therefore do
not work properly when they are called with an argument of a file named –i:
$ touch -i
touch: invalid option -- i
Try 'touch --help' for more information.
The following commands create a file named –i:
$ cat > -i
CONTROL-D
The preceding example uses the shell to create the file. It works because the
shell expects a filename following a redirect output symbol and does not
treat –i as an option.
Many utilities assume everything on the command line to the right of a ––
option is a filename. Using one of these utilities, you can work with a file
whose name begins with a hyphen by marking the end of the options on the
command line with the –– option followed by the filename:
$ touch -- -i
You can remove the file by using –– to signal the end of the options:
$ rm -- -i
One of the easiest ways to create and remove this file is to locate it in the
working directory as ./–i. The filename does not begin with a hyphen so
there is no confusion.
$ touch ./-i
$ rm ./-i

Computer Science & Information Technology

You might also like to view...

Calc worksheets display a large amount of data in a relatively small area

Indicate whether the statement is true or false

Computer Science & Information Technology

A(n) __________ symbol is used for an assignment statement in a flowchart.

a. parallelogram b. oval c. processing d. triangle

Computer Science & Information Technology