Need help on how to execute several programs


 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Need help on how to execute several programs
# 8  
Old 10-21-2018
Quote:
Originally Posted by RudiC
If your "code is written exactly as it is in post #1", how come the error msg in post#3 is different?
Need help on how to execute several programs-capturepng

I am not sure why it adds spaces. The only coding I have changed is in prog3, I changed the spacing in some areas, and the results are now

Code:
gaben:~/CS307> more prog3
more prog3
#
set pwrs=(00000000)
@ pwrs[1]=1
@ next=2
while($next<9)
   @ last=$next+1
   @ pwrs[$next]=$pwrs[$last]*2
   @ next=$next+1
end


@ count=1
while($count<=8)
   echo $pwrs[$count]
   @ count=$count+1
end
gaben:~/CS307> ./prog3
./prog3
@: Badly formed number.
gaben:~/CS307>

# 9  
Old 10-22-2018
prog3 is missing dozens of spaces that csh wants (again I was surprised when csh needs spaces and when not), and it should be last=next-1 to make sense.
Is it part of the exercise to fix the missing spaces or fix the code?
Are the missing spaces because of your typos, or is it your text editor?
# 10  
Old 10-22-2018
Quote:
Originally Posted by MadeInGermany
prog3 is missing dozens of spaces that csh wants (again I was surprised when csh needs spaces and when not), and it should be last=next-1 to make sense.
Is it part of the exercise to fix the missing spaces or fix the code?
Are the missing spaces because of your typos, or is it your text editor?
The only requirements for the assignment are to run the code, print output, and explain what the code does. The missing spaces which I noticed were due to trying to copy the code off a handout where the spacing is sometimes difficult to see. As for the line which you corrected, that was my own error, but even after correcting it, I still receive the same error: @: Badly formed number..
# 11  
Old 10-22-2018
Because of the missing spaces. Debug run of prog4:
Code:
csh -vx prog4


if ( $#argv==0 ) then
if ( 0==0 ) then
if: Badly formed number

One line is due to the -v option (verbose), and the following line is after parsing (substitutions) due to the -x option (debug).
You see it recognizes 0==0 as one token, but it needs 3 token i.e. two spaces:
Code:
if ( $#argv == 0 ) then

# 12  
Old 10-22-2018
Analog, prog3:
Code:
set pwrs=(0 0 0 0 0 0 0 0)
@ pwrs[1] = 1
@ next = 2
while ($next < 9)
   @ last = $next - 1
...

Especially the @ lines are very "spacy".
This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between inbuilt suid programs and user defined root suid programs under bash shell?

Hey guys, Suppose i run passwd via bash shell. It is a suid program, which temporarily runs as root(owner) and modifies the user entries. However, when i write a C file and give 4755 permission and root ownership to the 'a.out' file , it doesn't run as root in bash shell. I verified this by... (2 Replies)
Discussion started by: syncmaster
2 Replies

2. UNIX for Advanced & Expert Users

Check programs used most

How can you check the programs that you use most often? (6 Replies)
Discussion started by: cokedude
6 Replies

3. Shell Programming and Scripting

Automatically execute all programs in a directory

Hello. The last days I extended an open-source C++ library by some faster functions. This library provides a lot of short test programs which guarantee that the library works exactly. The compilation of each test works in a Makefile automatically. What I need is a shell script which... (5 Replies)
Discussion started by: max3000
5 Replies

4. UNIX for Dummies Questions & Answers

Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ?

Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right... (1 Reply)
Discussion started by: vishwamitra
1 Replies

5. AIX

Execute "telinit q" while programs are running ?

Hi, I want to make changes to inittab file and reread it using "telinit q" to make changes effective immediately. Is it safe to do that while important apps are running ? thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

6. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

7. Shell Programming and Scripting

help to execute programs in sequence through batch

I need help to create batch file . I want to run some programs in sequence in batch mode . I have one file which contains the name of program and command The test.bat file contain this data stsrun -v devel area1.exp stsrun -v devel prime1.exp stsrun -v devel treat.exp Please help... (1 Reply)
Discussion started by: getdpg
1 Replies

8. Shell Programming and Scripting

shell programs

how to write pipe for finding out the login names and login time of the users whose login name begins with p. (1 Reply)
Discussion started by: rameshparsa
1 Replies

9. Linux

Linux-programs

I have installed Red Hat Linux 9.0 recently on my computer. Im wondering if there are any good sites for downloading linux programs besides the site of Red Hat. Thank you in advance!:D (4 Replies)
Discussion started by: SolidSnake
4 Replies

10. UNIX for Dummies Questions & Answers

Where did my programs go?

I notice that (Mandrake) Linux and Windows do not seem to operate alike in terms of installing third party software. Windows, on one hand, creates icons and adds items to the Start Menu, with the help of the InstallShield--or equivalent, of course, but Linux, on the other hand, seems to care... (3 Replies)
Discussion started by: helvetica
3 Replies
Login or Register to Ask a Question