I have a .sh file in my machine containing "kill -9 $()" this line. I am unable to run this file. When I run that file it appears git bash and suddenly disappeared. Please help me to find the issue.
1 Answer
Your .sh (shell script) file seems to run fine with git bash for Windows actually.
The real question is: what are you trying to run?
If kill -9 $() is the only command inside that script, it does exactly what it is supposed to do: nothing.
Kill -9 followed by a PID (Process ID, an integer number), kills the task with that PID.
$() is a "command substitution". If you put another command inside round brackets, the output of that command will be used as the value to pass.
So, let's say:
kill -9 $(pgrep -x php)
The command above will terminate all the running tasks named exactly "php" (if any).
I believe you should put some useful stuff inside round brackets to see any real effect, supposed that killing a task is what we can call "see" an effect.
Bye.