Ben dosyaları gzipping bir komut dosyası yazıyorum.
Bir dosyayı sıkıştırıp aynı adda bir dosya oluşturabilirim ve bunu da gzip etmeye çalışabilirim, örn.
$ ls -l archive/
total 4
-rw-r--r-- 1 xyzzy xyzzy 0 Apr 16 11:29 foo
-rw-r--r-- 1 xyzzy xyzzy 24 Apr 16 11:29 foo.gz
$ gzip archive/foo
gzip: archive/foo.gz already exists; do you wish to overwrite (y or n)? n
not overwritten
Kullanarak gzip --forcegzip'i üzerine yazmaya zorlayabilirim foo.gz, ancak bu durumda, üzerine yazarsam veri kaybetme şansımın yüksek olduğunu düşünüyorum foo.gz. Gzip'i .gzdosyaları yalnız bırakmaya zorlayan bir komut satırı anahtarı yok gibi görünüyor ... istemde 'n' tuşuna basmanın etkileşimli olmayan bir sürümü.
Bunların GNU seçenekleri standardını izleyebileceğini umarak denedim gzip --noforceve gzip --no-forcehiçbiri işe yaramadı.
Bunun için basit bir çözüm var mı?
Düzenle:
Bunun, man sayfasını değil, bilgi sayfasını okumak için ödediği zamanlardan biri olduğu ortaya çıkıyor.
Bilgi sayfasından:
`--force'
`-f'
Force compression or decompression even if the file has multiple
links or the corresponding file already exists, or if the
compressed data is read from or written to a terminal. If the
input data is not in a format recognized by `gzip', and if the
option `--stdout' is also given, copy the input data without
change to the standard output: let `zcat' behave as `cat'. If
`-f' is not given, and when not running in the background, `gzip'
prompts to verify whether an existing file should be overwritten.
Kılavuz sayfasında metin eksikti ve arka planda çalışmadığında
Arka planda çalışırken, gzip istemez ve -fseçenek çağrılmadığı sürece üzerine yazılmaz .
find ./ ! -name "*gz" -exec gzip {} \; &bu işe yarıyor:find ./ ! -name "*gz" -print0 | xargs -0 -n 1 -t gzipgzip raporları:gzip: ./2012-July.txt.gz already exists; not overwritten