yellowman / nsh

OpenBSD networking configuration shell
http://www.nmedia.net/nsh/
Other
177 stars 27 forks source link

Change shell escape sequence #152

Closed smytht closed 2 months ago

smytht commented 3 months ago

from ! to & to simplify parsing the config files distinguish between nshrc ! comments and not confusing it with ! escape to shell ! escape to shell is now & not ! eg !ifconfig is now &ifconfig eg !man is now &man

stspdotname commented 2 months ago

The only problem I see here is that the exclamation mark is used for this purpose in many unix commands. One of the first ones to do so was probably ed(1), where ! features prominently for this use case. Finding another symbol which is as intuitive could prove challenging.

There is no similar convention in the CLIs of commercial routers, is there? Given that they'd rather shield their users from running arbitrary internal commands?

ogmaconnect commented 2 months ago

The problem with using ! to break to a shell

! is that is is present in nshrc configuration files... and we really dont want users copying and pasting configs and the ! vertical spacing characters escaping out to a shell

other vendors do like arista ... but you actually have to call the shell command like bash and then you have a shell rather than the ! ifconfig

I was proposing that & would be used as I dont believe it is used as a comment in nsh or in config files

On Fri, 16 Aug 2024 at 16:46, Stefan Sperling @.***> wrote:

The only problem I see here is that the exclamation mark is used for this purpose in many unix commands. One of the first one to do so was probably ed(1), where ! features prominently for this use case. Finding another symbol which is as intuitive could prove challenging.

There is no similar convention in the CLIs of commercial routers, is there? Given that they'd rather shield their users from running arbitrary internal commands?

— Reply to this email directly, view it on GitHub https://github.com/yellowman/nsh/pull/152#issuecomment-2293745363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYG62H4XXLZQ6JN5XWD6S53ZRYNGRAVCNFSM6AAAAABLLGPLXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG42DKMZWGM . You are receiving this because you are subscribed to this thread.Message ID: @.***>

-- Kindest regards, Tom Smyth

Mobile: +353 87 6193172 The information contained in this E-mail is intended only for the confidential use of the named recipient. If the reader of this message is not the intended recipient or the person responsible for delivering it to the recipient, you are hereby notified that you have received this communication in error and that any review, dissemination or copying of this communication is strictly prohibited. If you have received this in error, please notify the sender immediately by telephone at the number above and erase the message You are requested to carry out your own virus check before opening any attachment.

stspdotname commented 2 months ago

Understood.

As far as I know when ! appears in an nsh config file it is always followed by a newline.

So instead of changing the shell escape symbol, how about making interactive nsh ignore lines which only contain the exclamation mark? When the user wants to escape to a shell they could still use !sh or !ksh or whatever.

smytht commented 2 months ago

Im ok with this approach... I dont see a downside...

if you do a diff Ill do a manual page and update the manual page for !

!

!ifconfig !ksh !sh

On Fri, 16 Aug 2024 at 17:03, Stefan Sperling @.***> wrote:

Understood.

As far as I know when ! appears in an nsh config file it is always followed by a newline.

So instead of changing the shell escape symbol, how about making interactive nsh ignore lines which only contain the exclamation mark? When the user wants to escape to a shell they could still use !sh or !ksh or whatever.

— Reply to this email directly, view it on GitHub https://github.com/yellowman/nsh/pull/152#issuecomment-2293768847, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2INQEBGH2XR3W4KPW25NDZRYPDTAVCNFSM6AAAAABLLGPLXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTG43DQOBUG4 . You are receiving this because you authored the thread.Message ID: @.***>

-- Kindest regards, Tom Smyth.

smytht commented 2 months ago

Closing pull request going to imlement ! with no arguments is a noop instead and if someone wants to escape to a shell they need to call the shell by name !ksh !sh !csh !tsh