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..

set -x or -x will show which line the script failed.

Try it with a basic script.

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.