bash - Problems with OSX command line wildcard -


using bash shell in mac osx

i've been trying write short shell script take care of part of compilation process, when i'm trying run script on every file, wildcards seem not acting expect them to.

the script follows:

rm *.cs rm *.bin protoc -i. *.proto -o*.bin mono protogen -i:*.bin -o:*.cs 

now, when hand-type @ command line each file, works fine. however, when run through shell script using wildcards, winds creating "*.bin" , "*.cs", rather individual .bin , .cs files each of different inputs. misusing wildcards, or going weird?

try (not tested):

protofiles="*.proto" rm *.cs rm *.bin in $protofiles; binfile=${i/.proto/.bin} protc -i. $i -o$binfile done binfiles="*.bin" in $binfiles; csfile="${i/.bin/.cs} mono prtogen -i:$i -o:$csfile done 

anyway... suggest use makefiles job. try (not tested):

csfiles=a.cs b.cs d.cs e.cs  clean:         rm *.cs *.bin  %.bin: %.proto         protoc -i. $< -o $@  %.cs: %.bin         mono prtogen -i:$< -o:$@  all: $(csfiles) 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -