I am making one shell script
that helps me to copy all my assets to the dist
folder but I am facing weird issue while doing this
Code
extensions=("json" "pug")
printf -v text '**/*.%s ' "${extensions[@]}"
echo $text
I am getting: locales/de.json locales/en.json views/error.pug views/layout.pug
I want: **/*.json **/*.pug
My need
I want to copy all my json
and pug
files into my dist
folder and I am using copyfiles
npm
package to fullfil my need.
I want an array so if in future I want to add one another extension then I can add it easily, my goal is to write copyfiles **/*.json **/*.pug dist
My script
#!/bin/bash
extensions=("json" "pug")
folderName="dist"
rm -rf ./$folderName
echo "Removed $folderName folder"
echo "Build started"
tsc --project tsconfig.json
echo "Build ready"
printf -v text '**/*.%s ' "${extensions[@]}"
copyfiles "$text" $folderName
echo "Extensions added into $folderName"
I am executing this script with bash -e ./build.sh