but I get:
grep: $$: No such file or directory with this type awk: command line:1: {
awk: command line:1: ^ invalid charactere " ` " within the expression
expected output (for instance)
RESULT_VARIABLE contains “bash”
ERROR_HAPPENED contains “0” or 0 (I don’t know exactly)
Besides how can I test properly ERROR_HAPPENED. Two situations may happen:
1- the commands run to the last one and return an error code, possibly not 0 if something wrong happened
2- one command fails to run, leaving ERROR_HAPPENED unset or empty
my goal is something like that
IF (<An error happened>)
<manage error>
ELSE()
MESSAGE("Found shell is ${RUNNING_SHELL}")
<process success>
ENDIF()
ENDIF()
in fine I’d like to run execute_process within the INSTALL command in order to run additionnal commands during install, commands that will depend on the OS and the actual shell.
How can I fix my detection, without any prerequisite on the available shell(s)?
First awk `{ print $4 }` must be replaced by awk '{ print $4 }'
Second I could launch my command by delegating it to a script that I call from execute_process but then, it returns me the wrong shell.
The issue is on my part as cmake is launch through a bunch of scripts and the actual calling shell is changed on the way.
Thus ps | grep echo$$ is not the way to go…
My ultimate goal is to update PATH variable automatically during installation process but I’m starting to wonder if it’s actually possible under linux, as, in my undertanding, this variable must be updated from shell source file will be different from a shell to another and then it should be set for all possible shell on the targeted machine…
What would be the correct way to install an executable as a command, or giving path to a so library? At least only for a user (without the need to prompt for admin rights)
FWIW, editing people’s files like this should be documented and optional; I would certainly not be happy with programs editing my shell configs willy-nilly like that (because PATH is set up in ~/.local/share/systemd/user/path-env.service on my machine and zshrc getting random stuff would be…unfortunate).