3
The contents 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 wish to use the file
command in this directory, 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 can spell out the filenames and escape things manually, but I want to 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 *
?
1Simple, as expected ;-) – Aubin – 2013-08-20T18:59:16.200