1
0
Fork 0
mirror of https://github.com/JasonN3/build-container-installer.git synced 2025-12-25 10:57:55 +01:00

use xargs and add usage example

This commit is contained in:
Jason Nagin 2024-08-21 13:54:45 +00:00
parent f5d336905d
commit 634942733c
2 changed files with 35 additions and 5 deletions

View file

@ -1,13 +1,12 @@
SHELL = /bin/bash
docs:
find -name '*.md' | while read -r line; \
do \
source_file=$${line:2}; \
find -name '*.md' -print0 | xargs -0 -I {} bash -c ' \
source_file=$${1:2}; \
final_file=$${source_file//\//_}; \
mv "$${source_file}" "$${final_file}"; \
no_ext_source=$${source_file:0:-3}; \
no_ext_final=$${final_file:0:-3}; \
sed -i "s;(\(../\)*$${source_file});($${no_ext_final});g" $$(find -name '*.md'); \
done
' _ {}
find . -type d -empty -delete