zackargyle / react-bash

A configurable/extendable bash terminal React component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quotes

nloveladyallen opened this issue · comments

hacker@default ~ $echo "foo"
"foo"

Implementing this seems to require building a more robust parser from scratch i.e. a character-by-character crawl. Might be my limited JavaScript knowledge, but I can't think of a nice way to parse with .split sequence. Even so, a hacky .split that includes splitting by " and looking for matching quotes etc. might be more complex/inefficient than just a O(n) walk of the input. Per the ECMA spec, each call to split will walk down the string left-to-right. Unless we come up with some uber-ninja regex that fits the bash grammar 😛

Thoughts @zackargyle?

I've made a commit to remedy this.
echo $PATH "hello world"
will show
/ hello world

Is this the correct behavior?

@ErezSha that looks correct, yes.