Bash脚本重命名文件和Zip文件夹

时间:2018-08-02 00:07:37

标签: bash macos-high-sierra

我写了一个脚本来重命名文件夹中的某些文件,然后压缩整个文件夹。重命名有效,但是zip总是失败并显示“权限被拒绝”。这是我的脚本:

#!/bin/bash

echo 'Renaming .env file to .env.local...'
mv ~/Workspace/apps/v4/.env  ~/Workspace/apps/v4/.env.local
echo 'Renaming .env.production file to .env...'
mv ~/Workspace/apps/v4/.env.production  ~/Workspace/apps/v4/.env
echo 'Zipping folder for production…'
zip ../exampleapp.zip ~/Workspace/apps/v4 -x ".idea/*" ".editorconfig" ".gitattributes" ".gitignore" "example.pem" "public/node_modules/*" "public/untitled_folder/*" "public/bower_components/*" "public/src/*"
echo 'Renaming .env.local to .env...'
mv ~/Workspace/apps/v4/.env.local  ~/Workspace/apps/v4/.env

对此我一无所知,我想知道如何能够运行该脚本而不会出现“权限被拒绝”错误。

0 个答案:

没有答案