Home
Man
Search
Today's Posts
Register

Students must use and complete the template provided. If you do not use the template your post may be deleted! Special homework rules apply here.

Need help on how to execute several programs

Tags
execute, need help, program

Login to Reply

 
Thread Tools Search this Thread
# 8  
Old 4 Weeks Ago
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-capture-png

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 4 Weeks Ago
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 4 Weeks Ago
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 4 Weeks Ago
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 4 Weeks Ago
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".
The Following User Says Thank You to MadeInGermany For This Useful Post:
FaTaL (4 Weeks Ago)
Login to Reply

« Previous Thread | Next Thread »
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Difference between inbuilt suid programs and user defined root suid programs under bash shell? syncmaster UNIX for Dummies Questions & Answers 2 09-20-2015 03:13 PM
Scripting Programs Mack1982 Shell Programming and Scripting 8 03-07-2011 08:04 AM
Installation of programs kristinu Shell Programming and Scripting 1 07-16-2010 06:53 AM
Running programs kristinu Shell Programming and Scripting 0 07-14-2010 08:03 PM
Check programs used most cokedude UNIX for Advanced & Expert Users 6 07-09-2010 10:51 AM
Automatically execute all programs in a directory max3000 Shell Programming and Scripting 5 06-09-2010 06:06 PM
Are programs like sys_open( ) ,sys_read( ) et al examples of system level programs ? vishwamitra UNIX for Dummies Questions & Answers 1 10-28-2009 01:00 PM
Execute "telinit q" while programs are running ? vilius AIX 1 11-28-2008 05:38 AM
Compiling programs saveka Solaris 2 08-16-2007 10:41 AM
Need to execute 2 scripts, wait, execute 2 more wait, till end of file halo98 Shell Programming and Scripting 1 08-01-2006 05:42 PM
help to execute programs in sequence through batch getdpg Shell Programming and Scripting 1 07-22-2006 09:27 AM
Uninstalling programs? riwa Debian 1 03-30-2006 05:13 PM
shell programs rameshparsa Shell Programming and Scripting 1 11-17-2005 10:07 PM
Linux-programs SolidSnake Linux 4 02-18-2004 04:34 AM
Where did my programs go? helvetica UNIX for Dummies Questions & Answers 3 08-06-2001 11:12 PM


All times are GMT -4. The time now is 04:07 PM.

Unix & Linux Forums Content Copyright 1993-2018. All Rights Reserved.
UNIX.COM Login
Username:
Password:  
Show Password