Write a bash script to check output of git diff if changed files are in specific folder run yarn then zip

Completed Posted 5 years ago Paid on delivery
Completed Paid on delivery

I would like a bash shell script written which will check what files have changed with git. My project has two theme folders each folder has it's own scss and js assets. The bash script will check if files have changed in theme folder one or theme folder two or maybe both themes have changes to scss or js

The script will use git diff

Check which theme folders have changed files with extension .scss or .js

Then change directory to that theme folder and run yarn build

Then run zip -r [login to view URL] dist/

This will create a zip of the compiled assets for the theme

A few things to note are scss and js might be changed in both theme folders.

Only run yarn build once in each theme folder. So if 3 files are changed in a theme folder the yarn build will only run one time and zip the files

Here's some sample code to maybe help get you started

# folder path one includes "themes/one'

# folder path two includes "themes/two"

git diff --name-only | \

while read filechanged # folder/folder/themes/one/[login to view URL]

do

echo $filechanged

extension="${filechanged##*.}"

echo $extension

...

Bash Scripting Shell Script

Project ID: #17869923

About the project

5 proposals Remote project Active 5 years ago

Awarded to:

kaloyan13

Bash guru at your service. Its a simple bash script. I can do it in an hour. Thank you..............

$30 USD in 1 day
(147 Reviews)
6.2

5 freelancers are bidding on average $109 for this job

VarunUnix

Hi, I have not tried git within a shell script. But being a shell script, this is something i can do it easily based on your requirement. Only thing which confuse is the scss and js part. By the way, i will read thi More

$88 USD in 2 days
(11 Reviews)
3.4
nirmaljeetverma

Hello I am having lots of experience in bash scripting and i can do this task as well but i am having few questions to discuss so can you come on discussion Thanks Nirmal

$155 USD in 3 days
(5 Reviews)
2.8
sambestsolutions

Hi I am an Devops engineer experienced in shell scripting for linux system monitoring, troubleshooting, automation etc. I can do this bash script to find changed git repositories and then execute yarn build command on More

$72 USD in 6 days
(1 Review)
0.8