How to exit UEFI-Shell from startup.nsh - uefi

When startup.nsh is called automatically at start up, calling exit inside srcipt does only exit from script but not shell. But I´d like to exit the shell.
When I call the same script after start up just the normal way from shell with startup.nsh it exits the shell as expected.
Calling other scripts from automatically called script at start up with exit cmd does not work neither.
Edit:
ver gives me
EFI Specification Revision : 2.40
EFI Vendor : American Megatrends
EFI Revision : 5.10

Related

Use different command executor in vscode task

I have a task I'm using to run the make command for a build process in vscode. I want this command to be run in a specific environment instead of powershell since it has unix like calls in the makefile. I would like to use bash (git bash) or any shell binary instead.
The error I'm getting from the task for reference: The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command make" terminated with exit code: 1.
Thanks in advance

Run bash script in WSL through powershell script

I am trying to run a script which launches a WSL (ubuntu1804) terminal, and then run a bash script in that terminal
.\ubuntu1804.exe;
cd test_directory;
node server.js;
However after the first command the terminal open however, the two other commands aren't executed
.\ubuntu1804.exe by itself opens an interactive shell which PowerShell executes synchronously.
That is, until you submit exit in that interactive shell to terminate it, control won't be returned to PowerShell, so the subsequent commands - cd test_directory and note server.js - are not only not sent to .\ubuntu1804.exe, as you intended, but are then run by PowerShell.
Instead, you must pass the commands to run to .\ubuntu1804.exe via the run sub-command:
.\ubuntu1804.exe run 'cd test_directory; node server.js'
Note: Once node exits, control will be returned to PowerShell.

Application's exit status is different than when application run by shell script

I have a confusion over the exit code of the application and the bash return value. For an eclipse application, a command line interface ran using eclipse returns the exit code as 1 (which is expected upon error). but when I run same command line using shell file and checks the return value with "echo $?" it always returns value as 0.
Application launched in command line mode in Eclipse :
Shell script :
command ="toolCli.exe -application arguments"
$command
echo $?
Output I get here is always 0, what's exactly the difference here?
$ com="echoo hi"
$ $com
No command 'echoo' found, did you mean:
Command 'echo' from package 'coreutils' (main)
echoo: command not found
$ echo $?
127
As you can see the exit value does work, I believe your issue might be to do with the environment, as in the eclipse environment be different from your bash environment?
From the java path, it looks like you have a 64 bit windows env and that eclipse might be using the standard windows command line, so I'm interested in how you are expecting it to behave as a bash env?
So maybe run the command under a windows command line and see if it fails, compare the java setup in both environments.

How can I detect that a command completed its output in a tty?

I'm studying the code of Mobile Terminal which is a command line for iPhone.
The projects emulates a VT100 terminal.
I can monitor everything that goes through the terminal (ascii and control characters)
but I can't figure out how the terminal knows that a command completed its output. How
does the terminal know when to display the prompt again ? Is there a special control
character that every command sends when ending ?
To me it sounds like you're running a shell in the terminal, because a VT100 doesn't show a prompt (AFAIK).
A shell creates a child process and executes the command there. The shell then simply waits until this child process is finished and then prints its prompt again.
An exception is when the command is run in the background (some_command &), the shell doesn't wait for the child to exit and immediately prints the prompt again.

How do I exit the command shell after it invokes a Perl script?

If I run a Perl script from a command prompt (c:\windows\system32\cmd.exe), how can I exit the command prompt after the script finishes executing.
I tried system("exit 0") inside the Perl script but that doesn't exit the cmd prompt shell from where the Perl script is running.
I also tried exit; command in the Perl script, but that doesn't work either.
Try to run the Perl script with a command line like this:
perl script.pl & exit
The ampersand will start the second command after the first one has finished. You can also use && to execute the second command only if the first succeeded (error code is 0).
Have you tried cmd.exe /C perl yourscript.pl ?
According to cmd.exe /? /C carries out the command specified by string and then terminates.
If you're starting the command shell just to run the perl script, the answer by Arkaitz Jimenez should work (I voted for it.)
If not, you can create a batch file like runmyscript.bat, with content:
#echo off
perl myscript.pl
exit
The exit will end the shell session (and as a side effect, end the batch script itself.)
You can start the program in a new window using the START Dos command. If you call that with /B then no additional window is created. Then you can call EXIT to close the current window.
Would that do the trick?
You can send a signal to the parent shell from Perl:
kill(9,$PARENT_PID);`
Unfortunately, the getppid() function is not implemented in Perl on windows so you'll have to find out the parent shell PID via some other means. Also, signal #9 might not be the best choice.