tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bmake: how about :tr/CHARS/REPL/[1g]



 >> > >> How about adding new variable substitution :tr/CHARS/REPLS/[1g]
 >> > >> similar to tr(1).
 >> > 
 >> > Does the g flag really make sense here?  Or, rather, does its
 >> > absence?
 >> 
 >> S/str/repl/ defaults to S/str/repl/1, not to S/str/repl/g.
 >> 
 >> tr/// should probably follow this rule.

> 'g' does not make sense for tr,
Ok.

What is the final syntax for :tr then?
:tr/CHARS/REPL/
?

> and S doesn't default to '1', either.
It does.

 0 ~>cat /home/cheusov/tmp/2.mk
A=aaa
B=${A:S/a/b/}

all:
        @echo ${B}
 0 ~>make -f /home/cheusov/tmp/2.mk
baa
 0 ~>

> (For those following along at home,
My poor English doesn't allow me to decode this.

> 'g' on substitutions means to
> substitute all matches in each word, like the g flag in sed
> substitutions. '1' means to modify only the first word in the variable
> and skip the others entirely.)
Of course I know all this ;-)

> I meant to also say that having a tr substitution in make seems
> perfectly reasonable.
Should I implement it or sending a PR is enough?

-- 
Best regards, Aleksey Cheusov.


Home | Main Index | Thread Index | Old Index