I'm trying to launch and kill a background process in a script, but it gives me this error:
$ bash ./test.sh
7826
: arguments must be process or job IDs
My script code is:
#!/bin/bash
./program &
p_pid=$!
echo $p_pid
kill $p_pid
Debuging:
+ p_pid=$'8527\r'
+ echo $'8527\r\r'
8527
+ kill $'8527\r'
+ ./program
: arguments must be process or job IDs
How can I resolve this error?