Kill pid
The OS is AIX.
I created a program to kill long running pid processes. I am getting the following error message: -f command cannot be found. I also want to count the number of pids that are killed and append the results to a text file. I am new to shell script programming. 1.The first part of code is exporting a text file column containing ppids. pid.txt contents are as follows: Ppid 5569000 6789034 4567890 1234567 5678908 3457892 2. The second part of the code changes permission on the PpidFile 3. The third part of the code loops through the column in the text file and kill each Ppid. 4. finally a line of text is appended to a text file. The text contains the total number of pids killed and the date. Here is my code: Code:
|
What shell are you using?
The test should only have one set of single brackets, not double brackets as you have. See the red below. Quote:
|
Quote:
According to this see http://tldp.org/LDP/abs/html/testcon...ml#DBLBRACKETS [[ ]] is better. |
Quote:
To the Op: All of your other tests use single brackets. Check out chrism01's post, and make the adjustments. Also, you never answered what shell you were using. I don't know if this was a bad copy and paste job, you're missing some stuff: You're missing the done that goes with do. You're also missing two fis. Adding those to the end of your code, assuming nothing else is missing, the script works for me with bash. I get no error about -f. Without adding those three keywords, I get "unexpected end of file". |
You do realise I'm not the OP ??
;) Anyway, double brackets are better / more robust and I would urge the OP to use them in all cases. FWIW I was originally taught this on a course at Hewlett-Packard many years ago (technically for ksh, but the same logic applies) |
Quote:
|
|
All times are GMT -5. The time now is 06:53 PM. |