pesterhazy / bash2bb

44 stars 1 forks source link

Consider translating top-level echo as print/println #6

Open dundalek opened 1 year ago

dundalek commented 1 year ago

Printing with echo:

echo -n foo
echo bar

Gets translated as (which works correctly):

(shell "echo" "-n" "foo")
(shell "echo" "bar")

We could make the output for top-level echos (that are not part of a pipeline) a bit nicer and idiomatic if we translate them as:

(print "foo")
(println "bar")
pesterhazy commented 1 year ago

Hm, of course as you pointed out, the naive implementation doesn't work in pipe or command substitution contexts.

I'd like println to work in those contexts as well, but that'll require a bit more refactoring