If I call a command (in my case another script) with xterm as follows:
xterm -e sh second.sh
Value in $? after returning xterm is the xterm exit status code (usually 0 for me), not my script.
$?
Anyway, to get the exit status code of my script?
You can do something like this:
statusfile=$(mktemp) xterm -e sh -c 'yourcommand; echo $? > '$statusfile status=$(cat $statusfile) rm $statusfile
The exit status of yourcommand now in the status variable.
yourcommand
status
Source: https://habr.com/ru/post/903294/More articles:Android Get current date (with time 0: 00: 000) in Milliseconds? - androidCannot start Android 4.0 action bar. Split Action - androidjava.lang.Exception: port 8083 is already in use - javaHow to change the structure of MongoDB maps? - mongodbHow do you get exceptions in the implementation of EventMachine? - ruby | fooobar.comJackson serial sorting of a list - jsonhow can I set the maximum value in my html5 date input so that it can be recognized by safari for iOS? - dateCSS - How to center nested divs? - htmlScrolling marquee javascript image - javascriptProlog - how to clear memory and start from scratch? - memoryAll Articles