予期しない動作:bashのzip -r

予期しない動作:bashのzip -r

このスクリプトがあります。

#!/bin/bash

date="20180313"
source_path="/Users/<user_name>/Source/Git/WSI"
installer_path="../FE_Installer/cdk_installer/*"

echo "archive=$source_path/wsi_installers_$date.zip"
echo "path=$installer_path"

# Create the installer archive
zip -r "$source_path/wsi_installers_$date.zip" "$installer_path"

アーカイブが存在しない場合は、次のように失敗します。

zip warning: name not matched: ../FE_Installer/cdk_installer/*
zip error: Nothing to do! (try: zip -r /Users/<user_name>/Source/Git/WSI/wsi_installers_20180313.zip . -i ../FE_Installer/cdk_installer/*)

echoステートメントは正しいパスを表しますが:

archive=/Users/<user_name>/Source/Git/WSI/wsi_installers_20180313.zip
path=../FE_Installer/cdk_installer/*

-i オプションを使用して推奨コマンドを試しましたが、次のエラーで失敗しました。

zip warning: zip file empty

echoステートメントの出力を使用してzipコマンドを手動で実行する場合:

zip -r /Users/<user_name>/Source/Git/WSI/wsi_installers_20180313.zip ../FE_Installer/cdk_installer/*

効果があります:

adding: ../FE_Installer/cdk_installer/ADP_Installers.hta (deflated 71%)
adding: ../FE_Installer/cdk_installer/StartHta.exe (deflated 71%)
adding: ../FE_Installer/cdk_installer/WSPCP_TDI/ (stored 0%)
...
adding: ../FE_Installer/cdk_installer/common/styles/plugins.css (deflated 85%)
adding: ../FE_Installer/cdk_installer/common/styles/table.css (deflated 80%)
adding: ../FE_Installer/cdk_installer/updatecenter/ (stored 0%)

その後、スクリプトを実行すると動作し、出力にアーカイブが更新されていることが表示されます。

updating: ../FE_Installer/cdk_installer/ADP_Installers.hta (deflated 71%)
updating: ../FE_Installer/cdk_installer/StartHta.exe (deflated 71%)
updating: ../FE_Installer/cdk_installer/WSPCP_TDI/ (stored 0%)
...
updating: ../FE_Installer/cdk_installer/common/styles/plugins.css (deflated 85%)
updating: ../FE_Installer/cdk_installer/common/styles/table.css (deflated 80%)
updating: ../FE_Installer/cdk_installer/updatecenter/ (stored 0%)

私は何を見逃していますか?

ベストアンサー1

私の考え*ではinstaller_path拡張されません。ただ取り出してください*installer_path

おすすめ記事