LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   run a c.sh script line by line (https://www.linuxquestions.org/questions/linux-newbie-8/run-a-c-sh-script-line-by-line-492848/)

kenn_rosie@msn.com 10-16-2006 10:29 AM

run a c.sh script line by line
 
I would like to run a simple c.sh script line by line to test each line... is that possible?

crep 10-16-2006 11:52 AM

no, because some line (in loops etc) are dependant on previous lines in the file. feel free to try it to see what i mean.

jyoung4 10-16-2006 01:22 PM

Running a C shell script, line by line
 
(I'm assuming that when you said you wanted to run a c.sh script you meant a C shell script)

I don't know of any way to run it line by line but ...

You can turn on the x and v options to have it display what it's executing after expanding any wild card characters like "*" and what the results were. To do this start the script like this:

csh -xv /home/jay/myscript.csh arg1 arg2

If you get a lot of output from this, you may want to redirect it to a file.

makyo 10-16-2006 02:52 PM

Hi.

As my neighbor jyoung4 from across the river says, "-vx" is about all you can do easily. You can be more more precise by setting and unsetting the echo and verbose variables so that you don't need to slog through a lot of output. See man csh for information (but it's just:
Code:

set echo
set verbose

commands-to-be-echoed-before-and-after-history-and-execution

unset echo
unset verbose

so there isn't much more to it.)

If you are really ambitious, the O'Reilly Learning the bash Shell book has a chapter on writing a script debugger. Of course, you'd need to make a lot of changes. It does breakpoints, steps, etc., all the stuff you might want to do.

Some people, perhaps most, feel that csh-related shells are not suitable for scripting. There are many drawbacks -- see this, but sometimes we just need to get a job done.

Best wishes ... cheers, makyo


All times are GMT -5. The time now is 11:52 PM.