Sample Header Ad - 728x90

How to pass a parameter to a command that's being executed by exec in bash?

2 votes
1 answer
267 views
I'm trying to start a subprocess with a unique process name from a bash script. This works:
bash -c "exec -a MyUniqueProcessName './start_service' &"
but my problem is that I want to pass a parameter to start_service. If I do something like
bash -c "exec -a MyUniqueProcessName './start_service param' &"
or
bash -c "exec -a MyUniqueProcessName './start_service $myvar' &"
then it fails with complaining about
/start_service param: No such file or directory
What am I doing wrong?
Asked by Adam Arold (133 rep)
Mar 20, 2024, 01:36 PM
Last activity: Mar 20, 2024, 04:44 PM