Use ./*glob*

I used this site to check a script.

ShellCheck - shell script analysis tool

Line 57:
zip -u -q  Desktop_Items.zip *.desktop
                         ^-- [SC2035](https://github.com/koalaman/shellcheck/wiki/SC2035): Use ./\*glob* or -- \*glob* so names with dashes won't become options.

I do not understand what is wrong with my zip statement?

Try

zip -u -q Desktop_Items.zip ./*.desktop

as it says: Use ./*glob*

or

zip -u -q Desktop_Items.zip -- *.desktop

as it says: or -- *glob*

1 Like

Thanks.

Ok, so I just preface ./ to any wildcard?

My file name has an underscore and no dash.

------ Post updated at 07:26 PM ------

It appears that the zip utility you are using, does not know what's an option and what's a file to work upon, if you give it a glob (which it could represent one or more files). So it wants you to make it easy for it to identify what's what, by either using the -- (which means, treat anything after that not like an option) or identifying a path like (current directory) ./whatever

From the zip manual

Wildcards:
  Internally zip supports the following wildcards:
    ?       (or %% or #, depending on OS) matches any single character
    *       matches any number of characters, including zero

Am I to understand that zip would know what to do with zip file.zip *.sh ?

Sure it does, but as soon as it sees that you are giving it a glob it wants you to identify where the options ends and where the files start, it case that there's a file starting with a - , it doesn't interpreter it as an option.

 Use ./*glob* or -- *glob* so names with dashes won't become options.
1 Like

Ok, thanks.