how to check which line of the script is showing the error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to check which line of the script is showing the error
# 1  
Old 03-31-2010
how to check which line of the script is showing the error

how to check which line of the script is showing the error...

like -x will print each output in stdout...
but want to know exact error line trowing error..
# 2  
Old 04-01-2010
set -x or -x will show which line the script failed.

Try it with a basic script.
# 3  
Old 04-01-2010
With ksh and bash you can use the -n switch to do a parser pass on your script to check for syntax errors.

Other than that you'll have to have a rudimentary logging mechanism in your script.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to check line end not ending with comma

I have several line in a text file. for example I like apple; I like apple I like orange; Output: I like apple I try to useif grep -q "!\;$"; then (Not work) Please use CODE tags when displaying sample input, sample output, and code segments (as required by forum rules). (1 Reply)
Discussion started by: cmdcmd
1 Replies

2. Shell Programming and Scripting

Syntax error from cshrc, but not showing line number

Hi, I have been using ksh till now but was forced to use tcsh from last few days. I am getting a gvimrc error which says "set: Syntax error". What makes this pesky is that it is not showing which line number is the error from. How do I get the line number of the error? Also, I am using the... (11 Replies)
Discussion started by: rishikpillai90
11 Replies

3. UNIX for Dummies Questions & Answers

GDB not showing line details

I have bunch of source code which I compiled using -ggdb3 flag. I have copied the source code and executable to an another machine. When I run the exe in gdb it does not show the statments at the line numbers when it breaks. This is what I see Breakpoint 1, TestCode (handler=0x806e110,... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

4. Shell Programming and Scripting

How to check if script is run via cron or manual=command line?

Hi all, I have a script that can be run via cron or via the command line. Is there any way that I can place something on the script to be able to distinguish/differentiate whether the script was run via a user in the command line or whether it was run from the cron? (3 Replies)
Discussion started by: newbie_01
3 Replies

5. Shell Programming and Scripting

help on shell script to check line

Hi Scripting Gurus, Can someone help to transform the below logic into a shell script, might be easy for some of you. I have a file with below text, I need if the line has the ":" and the above to it is not a blank line should print " <text>: is incorrect format" Apple: ... (3 Replies)
Discussion started by: usyseng
3 Replies

6. Shell Programming and Scripting

shell script to check blank line?

Can someone help to transform the below logic into a shell script, might be easy for some of you. I have a file with below text, I need if the line has the ":" and the above to it is not a blank line should print " <text>: is incorrect format" Apple: vitamin = A... (0 Replies)
Discussion started by: usyseng
0 Replies

7. Shell Programming and Scripting

Check Error On Script

If I have a script createdb.sh ... psql -U postgres -c "create database dbname" ... I want to write something like if IsErr(psql -U postgres -c "create database dbname") ehco "OK" else ehco "NOT OK" Thank for any reply first (3 Replies)
Discussion started by: uativan
3 Replies

8. Shell Programming and Scripting

script to check error

I have below script to check the word in the driectory /ora_tmp , there are many files in this directory , if the word "error" is exist in any file within 5 day , then send the mail to ora-usr@mydomain.com about which file have this word and the "error" statement , now , if I want 1. if there... (2 Replies)
Discussion started by: ust
2 Replies

9. Filesystems, Disks and Memory

Showing an extra record/line

Hello everybody, I am working on ETL side. My job is to load the data from Oracle table to flat file and from flat file to oracle table using ETL tool Informatica. My flat files are fixed width. In the first phase, it is loading 66351 records into data file through tool. When I checked through... (1 Reply)
Discussion started by: srivsn
1 Replies

10. Shell Programming and Scripting

Showing extra line/record in file

Hello everybody, My job is to load the data from Oracle table to flat file and from flat file to oracle table using ETL tool Informatica. My flat files are fixed width. In the first phase, it is loading 66351 records into data file through tool. When I checked through wc -l <data filename> it is... (1 Reply)
Discussion started by: srivsn
1 Replies
Login or Register to Ask a Question