Executing 'exit' command from shell script

Hi,

I am writing shell script to automate few use cases for CLI interface. We have CLI interface which has bunch of commands. I am trying to execute one of the commands 'exit' as part of automation to exit from CLI object (not from shell script) in my shell script.

My intension is to execute 'exit' command on CLI as part of some automation, I do not want to exit from shells script.

The issue is, when I execute 'exit' command on CLI interface, shell script thinks that it is the 'exit' command to exit from shell script which is obvious but I am trying to see what can be the option which will run 'exit' command on CLI but that will not exit from my shell script.

Any help would be much appreciated!

Thanks,

Are you saying you want your script to run as a daemon? Are you in linux?

Does your CLI have an exit function?

It sounds like your CLI is supposed to do command line preprocessing, then the result is passed back to the shell, except the preprocessor has no visible exit function defined when you run it. Note that exit is a builtin command for some shells. By that I mean it may not be possible to bypass the command exit, unless there is a way to disable the shell builtin.

Note that in the standards, exit is a special built-in (which means that there is no PATH lookup for it and there is frequently no way to override or disable it).

If you want to run something like "/usr/local/bin/exit", you need to specify the entire path. Trying to invoke it with just "exit" will invoke the shell built-in command even if "/usr/local/bin" is in your path envval. And that causes the shell to exit.