UN*X : How to escape files containig special characters like -, or spaces
The content of a directory:
$ ls -l
total 122639
-rw-r--r-- 1 125578080 Aug 20 17:47 - Diana Krall, Stan Getz & Oscar
Peterson.7z
drwxr-xr-x 4 4096 Aug 20 18:02 Java
I whish to use the file command in this dir, where a lot of various files
are copied
$ file *
The result I expect:
$ file *
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
java: directory
The result I get:
$ file *
file: illegal option --
file: illegal option -- D
file: illegal option -- a
file: illegal option -- a
file: illegal option --
file: illegal option -- K
file: illegal option -- a
file: illegal option -- l
file: illegal option -- l
file: illegal option -- ,
file: illegal option --
file: illegal option -- S
file: illegal option -- t
file: illegal option -- a
file: illegal option --
file: illegal option -- G
Usage: file [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
[-e testname] [-F separator] [-f namefile] [-m magicfiles]
file ...
file -C [-m magicfiles]
file [--help]
I may type the following specific commands but I don't want, I wish use *:
$ file -- -\ Diana\ Krall\,\ Stan\ Getz\ \&\ Oscar\ Peterson.7z
- Diana Krall, Stan Getz & Oscar Peterson.7z: 7-zip archive data, version 0.3
$ file java
java: directory
How can I escape or protect * ?
No comments:
Post a Comment