oilshell / oil

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.78k stars 150 forks source link

shopt -p and -o compatibility with bash #2013

Open momiji opened 4 days ago

momiji commented 4 days ago

-o changes which settings are displayed -p display commands instead of a table

In hope this is now the correct behavior.

andychu commented 4 days ago

Hm are you relying on this behavior anywhere?

I agree that we are little incompatible with other shells, because we don't print this format

But we DO print an unambiguous format that you can parse

andy@hoover:~/git/oilshell/oil$ bash -c 'set -o' |head
allexport       off
braceexpand     on
emacs           off
errexit         off
errtrace        off
functrace       off
hashall         on
histexpand      off
history         off
ignoreeof       off

andy@hoover:~/git/oilshell/oil$ zsh -c 'set -o' |head
noaliases             off
aliasfuncdef          off
allexport             off
noalwayslastprompt    off
alwaystoend           off
appendcreate          off
noappendhistory       off
autocd                off
autocontinue          off
noautolist            off

andy@hoover:~/git/oilshell/oil$ mksh -c 'set -o' |head
Current option settings
allexport      off                                                                         markdirs       off                                                                         privileged     off
asis           off                                                                         monitor        off                                                                         restricted     off
bgnice         off                                                                         noclobber      off                                                                         sh             off
momiji commented 3 days ago

Yes I agree, it just to mimic the behavior of other for the table display. The objective here is to get closer to bash for being a "near bash replacement".

As mentioned, all shells did not print the same, bash using space+tab while the others don't.

It doesn't really matter as most of the time it's just for printing, and in scripts most probably used with awk or grep off$. And regarding the idea to display both shopt and set options, maybe we can add a -a for all ;)