Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

{module::name.filetype} to _modules/name/application.filetype

$
0
0
Code:

path      = content.txt
filename  = application
directory = _modules
 
define create
        $(eval from := $(shell echo $$1)) \
        $(eval to  := $(shell echo $$2)) \
        sed -i '' 's/$(from)/$(to)/g' content.txt
endef
 
all:
        clear
 
        $(eval modules := $(shell egrep -o "{module[^ ]+\}" $(path)))
 
        @for m in $(modules); do \
                $(call create, $$m, \
                        $$m \
                        | sed 's/{module\([^ ]*\).*}/\1/' \
                        | sed 's/\./\/$(filename)\./g' \
                        | sed 's/\::/\$(directory)\//g' \
                ); \
        done

I'm getting this error:
sed: first RE may not be empty

I think the reason for it is because I can not use shell script inside of a for loop because $$1 is returning null.
Anyone have any idea how to solve this issue?

Viewing all articles
Browse latest Browse all 13329

Trending Articles