Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad substitution when running find . -type f command #5

Open
deffcolony opened this issue Nov 10, 2023 · 0 comments
Open

Bad substitution when running find . -type f command #5

deffcolony opened this issue Nov 10, 2023 · 0 comments

Comments

@deffcolony
Copy link
Contributor

The following command from the readme.md:
find . -type f -name 'example-*' -exec sh -c 'cp -rf "$0" "${0/example-/}"' {} \;

gave me the following error when running inside nitro-docker folder:

./example-.cms.env: 1: Bad substitution
./nitro/example-ui-config.json: 1: Bad substitution
./nitro/example-renderer-config.json: 1: Bad substitution

The solution:

This command will copy and removes example- from the files, and if the copy is successful, it will remove the original files.
find . -type f -name 'example-*' | while read -r file; do new_file=$(echo "$file" | sed 's/example-//'); cp -rf "$file" "$new_file" && rm "$file"; done

Advice

The command could be included inside the automated command list at readme.md:

git clone https://github.com/Gurkengewuerz/nitro-docker.git && \
cd nitro-docker/ && \
git clone https://git.krews.org/morningstar/arcturus-morningstar-default-swf-pack.git assets/swf/ && \
git clone https://github.com/krewsarchive/default-assets.git assets/assets/ && \
wget https://github.com/billsonnn/nitro-react/files/10334858/room.nitro.zip && \
unzip -o room.nitro.zip -d assets/assets/bundled/generic && \
find . -type f -name 'example-*' | while read -r file; do new_file=$(echo "$file" | sed 's/example-//'); cp -rf "$file" "$new_file" && rm "$file"; done
 && \
docker compose up db -d

Or... you could modify the existing command from readme.md at the top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant