1

To estract a single .Z file from a given folder I use uncompress file.Z in a terminal and it works flawlessy. If, in the same folder, I want to extract all the .Z files I use uncompress "*.Z" or uncompress '*.Z' or uncompress \*.Z. But they all give the same error:

gzip: *.Z: No such file or directory

(There I have used various forms of quotes just to show that quotes should not be the problem).

Same story if I use the "extended" extension proper of each file, that is file.fitz.Z. How do I uncompress all the .Z files? What is going wrong?

PS: This has already been posted on the SO, but no luck yet (although I could not imagine the question is that hard to answer).

1 Answer 1

5

It looks like everything you have tried is escaping the special character * causing it to be interpreted literally instead of as a wildcard.

Try using this instead:

uncompress *.Z

"*.Z" Double quotes will preserve the literal value of the *

Enclosing characters in double quotes (‘"’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’.

'*.Z' Single quotes will preserve the literal value of everything

Enclosing characters in single quotes (‘'’) preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.

\*.Z An escape (backslash) will also preserve the literal value of *

A non-quoted backslash ‘\’ is the Bash escape character. It preserves the literal value of the next character that follows, with the exception of newline.

2
  • 1
    I will go and hide my head under the sand: it worked! Thanks\
    – Py-ser
    Dec 21, 2017 at 16:56
  • @Py-ser, the only reason I remember is because I have made the same mistake in the past. :)
    – jesse_b
    Dec 22, 2017 at 1:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .