Home Explore Blog CI



man-pages

30th chunk of `zip.man`
25ad25e6ca0649353eeff830785b81ae45a836676abbc4fa0000000100000fbc
 ‐RE option
              to avoid the confusion that names with [ or ] have caused.

       When these characters are encountered  (without  being  escaped  with  a
       backslash or quotes), the shell will look for files relative to the cur‐
       rent  path  that match the pattern, and replace the argument with a list
       of the names that matched.

       The zip program can do the same matching on names that are  in  the  zip
       archive  being  modified  or, in the case of the -x (exclude) or -i (in‐
       clude) options, on the list of files to be operated on, by  using  back‐
       slashes  or  quotes  to tell the shell not to do the name expansion.  In
       general, when zip encounters a name in the list of files to do, it first
       looks for the name in the file system.  If it finds it, it then adds  it
       to  the  list  of files to do.  If it does not find it, it looks for the
       name in the zip archive being modified (if it exists), using the pattern
       matching characters described above, if present.   For  each  match,  it
       will  add  that  name  to the list of files to be processed, unless this
       name matches one given with the -x option, or does not  match  any  name
       given with the -i option.

       The  pattern matching includes the path, and so patterns like \*.o match
       names that end in ".o", no matter what the path prefix  is.   Note  that
       the  backslash  must precede every special character (i.e. ?*[]), or the
       entire argument must be enclosed in double quotes ("").

       In general, use backslashes or double quotes for paths that  have  wild‐
       cards to make zip do the pattern matching for file paths, and always for
       paths  and strings that have spaces or wildcards for -i, -x, -R, -d, and
       -U and anywhere zip needs to process the wildcards.

ENVIRONMENT
       The following environment variables are read and  used  by  zip  as  de‐
       scribed.

       ZIPOPT
              contains default options that will be used when running zip.  The
              contents  of this environment variable will get added to the com‐
              mand line just after the zip command.

       ZIP
              [Not on RISC OS and VMS] see ZIPOPT

       Zip$Options
              [RISC OS] see ZIPOPT

       Zip$Exts
              [RISC OS] contains extensions separated by a :  that  will  cause
              native filenames with one of the specified extensions to be added
              to the zip file with basename and extension swapped.

       ZIP_OPTS
              [VMS] see ZIPOPT

SEE ALSO
       compress(1), shar(1), tar(1), unzip(1), gzip(1)

DIAGNOSTICS
       The  exit status (or error level) approximates the exit codes defined by
       PKWARE and takes on the following values, except under VMS:

              0      normal; no errors or warnings detected.

              2      unexpected end of zip file.

              3      a generic error in the zipfile format was detected.   Pro‐
                     cessing  may have completed successfully anyway; some bro‐
                     ken zipfiles created by other archivers have simple  work‐
                     arounds.

              4      zip  was unable to allocate memory for one or more buffers
                     during program initialization.

              5      a severe error in the zipfile format was  detected.   Pro‐
                     cessing probably failed immediately.

              6      entry  too  large  to  be  processed  (such as input files
                     larger than 2 GB when not using Zip64 or trying to read an
                     existing archive that is too large) or entry too large  to
                     be split with zipsplit

              7      invalid comment format

              8      zip ‐T failed or out of memory

              9      the  user aborted zip prematurely with control‐C (or simi‐
                     lar)

      

Title: Pattern Matching Details, Environment Variables, and Diagnostics
Summary
This section delves into the details of pattern matching with zip, explaining how zip uses backslashes or quotes to prevent the shell from doing name expansion, allowing zip to find files in the file system or the zip archive. It then discusses environment variables such as ZIPOPT, ZIP, Zip$Options, Zip$Exts, and ZIP_OPTS that affect zip's behavior. Finally, it lists the diagnostic exit status codes returned by zip, indicating the success or failure of the operation and the type of errors encountered.