oils-for-unix / oils

Oils is our upgrade path from bash to a better language and runtime. It's also for Python and JavaScript users who avoid shell!
http://www.oilshell.org/
Other
2.85k stars 159 forks source link

Implement `^string1^string2^` bashism #2082

Open nisbet-hubbard opened 1 month ago

nisbet-hubbard commented 1 month ago

It’d be really nice to see this quick substitution shorthand implemented in oils. It’s one of those things that make working with shell so enjoyable!

andychu commented 1 month ago

Hm yeah I know about this, but it hasn't been requested for

There is an (old) related issue #452 where we are going to diverge from bash

Baically bash does "naive" history, and most people are surprised that echo "!!" doesn't show two exclamation points

Instead it expands history

So we are probably going to integrate history into the main parser, so it can respect ""


That should come before doing ^foo^bar, but we can consider it as part of the same change

I'm not sure of the exact syntax of ^ -- the first step is always to write some automated tests, which we can use help with