checking for script errors


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting checking for script errors
# 1  
Old 01-17-2004
checking for script errors

ok, i have a script which i use to search my process' for specific keywords and kill any process containing them. there is a prompt to enter a keyword for searching and another prompt for which user you want to search the process' of. i want the script to have something that if you entered a search term that is not found or a nonpresent user to return a "incorrect search terms, re-enter a keyword or user that can be found" and the prompt would pop back up. this would be instead of a bunch of "no such pid" or other kinds of error messages. that may be a little confusing but is there any way to do what im trying?

thanks, blip
# 2  
Old 01-18-2004
Look up "man grep" and check out the section on using the "$?" combo as a way to see if the grep was successful or not... those same symbols return a code on whether or not a lot of commands were successful.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script will keep checking running status of another script and also restart called script at night

I am using blow script :-- #!/bin/bash FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not if then # echo "process found" exit 0; else echo "process not found" exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies

2. Shell Programming and Scripting

Shell Script for continuously checking status of a another script running in background, and immedia

Hi, I want to write a script which continuously checking status of a script running in background by nohup command. And if same script is not running then immediately start the script...please help.. i am using below command to run script nohup system_traps.sh & but in some... (9 Replies)
Discussion started by: ketanraut
9 Replies

3. Shell Programming and Scripting

need help with ksh script errors

#!/bin/ksh number1="20" if then number1=$1 fi number2="1" while ] do if ] then print "FizzBuzz" elif ] then print "Fizz" elif ] then ... (3 Replies)
Discussion started by: bjhum33
3 Replies

4. UNIX for Dummies Questions & Answers

How to ignore errors in script

I have a simple script that processes files. Here's a simplified example of what I'm doing: foreach t (web.*) mv $t dnw$t:e.log end foreach t (card.*) mv $t card$t:e.log end The problem is that sometimes there is no web.* file. In that case, I get an error "foreach: No match" and... (4 Replies)
Discussion started by: software5723
4 Replies

5. Shell Programming and Scripting

Help with execution errors in script

solution found.... Please use tags for scripts, listings, and console output (2 Replies)
Discussion started by: audiolord
2 Replies

6. Shell Programming and Scripting

Help with shell script errors

hey watsup guys i am new in the shell script world. so i need help fom you guys, i have written these two codes and they both give the same errors( expr : syntax error). Code 1 : #! /bin/sh # count1 appends an increment to a file 200 times # note that a file called numbers must be... (5 Replies)
Discussion started by: surubi_abada
5 Replies

7. Shell Programming and Scripting

Script to capture errors

Hello; I'm trying to write a script to capture any hardware error from logs/syslog on my SUSE 10 servers so i can be notified if we have any hardware issues such a bad fan or battery, etc.. Thanks in advance for any help (2 Replies)
Discussion started by: Katkota
2 Replies

8. Shell Programming and Scripting

checking ERRors in files

I m having trouble in a script.I need To write a script that will check for Following Errors in Logs Files,i.e files having Extension .log The erros are 2008-01-01 15:19:11,822 ERROR - ORA-01115: IO error reading block from file 51 (block # 717090) ORA-01110: data file 51:... (4 Replies)
Discussion started by: ali560045
4 Replies

9. Programming

Errors while Compiling a PC script.

Hi all, I have created a post-C (PC) script OrdItmpopulate.pc. When I am compiling this using the “Make” command I am getting the following error. My “make” command looks like this: make -f $ORACLE_HOME/precomp/demo/proc/demo_proc.mk build EXE=OrdItmpopulate8.exe OBJS="OrdItmpopulate8.o"... (1 Reply)
Discussion started by: musavir19
1 Replies

10. UNIX for Dummies Questions & Answers

unix script errors

#!/bin/ksh sqlplus -s user/passwd@remoteserver << EOF > errors2.log set pagesize 0 feedback off verify off heading off echo off select directory_nm || '/' || file_nm || '|' ||venue_id || '|' || time_id from file_control; EOF The output of this script is; ... (2 Replies)
Discussion started by: pavan_test
2 Replies
Login or Register to Ask a Question