LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2006, 10:29 AM   #1
kenn_rosie@msn.com
LQ Newbie
 
Registered: Oct 2006
Posts: 1

Rep: Reputation: 0
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?
 
Old 10-16-2006, 11:52 AM   #2
crep
Member
 
Registered: Aug 2004
Location: US
Distribution: Fedora, FBSD, Solaris
Posts: 46

Rep: Reputation: 15
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.
 
Old 10-16-2006, 01:22 PM   #3
jyoung4
LQ Newbie
 
Registered: Apr 2006
Location: Minneapolis, Minnesota, USA
Posts: 16

Rep: Reputation: 1
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.
 
Old 10-16-2006, 02:52 PM   #4
makyo
Member
 
Registered: Aug 2006
Location: Saint Paul, MN, USA
Distribution: {Free,Open}BSD, CentOS, Debian, Fedora, Solaris, SuSE
Posts: 735

Rep: Reputation: 76
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

Last edited by makyo; 10-16-2006 at 02:54 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash shell script read file line by line. Darren[UoW] Programming 57 04-17-2016 06:07 PM
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
C++ text file line by line/each line to string/array Dimitris Programming 15 03-11-2008 08:22 AM
Script to read line by line from a file kushalkoolwal Programming 20 01-27-2006 04:17 AM
Loop line by line script twantrd Programming 7 01-16-2005 11:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration