05-23-2012
A simple loop made difficult WTH
Can anyone assit me in completing this simple looping problem
allow the user to enter as many number as they want by using a loop. The program will keep asking the user for additional numbers until the user enters 9999. Once the user enters 9999, exit the loop and display a message telling them which number they entered was the largest of all of their entries. The number 9999 should only be used to exit the loop and should not be used as one of the entries to determine the largest number. For example, if the user enters the numbers 1, 29, 354, 231, 9999, the output should say "The largest number you entered was 354".
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hallo everyone
I might just be being dumb, but I am using the BASH shell and cannot get the following script to work:
x=0
while
do
echo $x
x=´echo "$x + 1" | bc´
done
Can anybody help me out. I am just get a repeating output saying:
bc: command not found
0 + 1: command not... (5 Replies)
Discussion started by: syno
5 Replies
2. Shell Programming and Scripting
i have the following process running in background:
when i give "ps -lef"
------------------------------------------------------------------------
user2
user1
user1
user3
user1
user4
user5
user4
user3
user4
user2
user1
user1
user3
user1
user4 (3 Replies)
Discussion started by: ali560045
3 Replies
3. Shell Programming and Scripting
i have a script called file2
#!/bin/ksh
i=0
while
do
echo $i >> result.txt
i=`expr $i + 1`
done
echo "***********************" >> result
------------------------------------------------------------------- (10 Replies)
Discussion started by: ali560045
10 Replies
4. Shell Programming and Scripting
I have what I believe is a simple programming question. I have a text file that looks like:
mol 1 G:\stereo01.hin
block text
...
...
...
endmol 1
However, I would like a file that repeats this entire block of text several times over. The lines of text in the middle remain the same for each... (2 Replies)
Discussion started by: red baron
2 Replies
5. Shell Programming and Scripting
Hello
I am a beginner of shell scripting and i am having trouble to do a for loop.
I want a for loop to do stuff 3 times.
i.e.
in visual basic i do this
for (counter = 0; counter < 3; counter++)
on my shell script i have something like this at the moment
... (7 Replies)
Discussion started by: arex876
7 Replies
6. Shell Programming and Scripting
Hi expert,
I'm using csh
Code:
#!/bin/csh
set x = 0
set number = `awk '{array=$0} END {print array;}'`
i want to use for loop to store data to $number repeatly
untill x = 23
How to use c shell for loop? (2 Replies)
Discussion started by: vincyoxy
2 Replies
7. UNIX for Dummies Questions & Answers
I need to chmod a bunch of files with a specific extension in one directory.
If I understand correctly first I would run ls command like this
ls -R | grep .mp3 > /tmp/list
once I have the output file I should be able to run a loop to chmod all the files in the list created.
This is where... (5 Replies)
Discussion started by: eugenes18t
5 Replies
8. Shell Programming and Scripting
Does any body can help me with a loop in this example?
if
then
if
then
runner=$(grep "$1" "$2")
runne=$(grep "$1" "$3")
run=$(grep "$1" "$4")
fi
fi
#
# Message on screen... (3 Replies)
Discussion started by: bartsimpsong
3 Replies
9. Shell Programming and Scripting
Dear experts,
I am writing a bash script. At some point of the program I need to have 'for' loop. For simplicity I tried with some other simple code. The format of the loop is given below.
k=51
m=55
for j in {$k..$m};do
w=$(($j+2))
z=$(($j+9))
echo "$w, $z"
done
But my... (4 Replies)
Discussion started by: vjramana
4 Replies
10. Shell Programming and Scripting
VARA='hello|welcome|gone|fantastic|superb|nicecar'
if VARA contains a pipe "|", i want the contents of VARA to be tranformed to:
VARA="(hello) (welcome) (gone) (fantastic) (superb) (nicecar)"
so that, when i echo the contents of $VARA like this:
echo "$VARA"
or like this:
print... (8 Replies)
Discussion started by: SkySmart
8 Replies
LEARN ABOUT DEBIAN
pvm_notify
NOTIFY(3PVM) PVM Version 3.4 NOTIFY(3PVM)
NAME
pvm_notify - Request notification of PVM event such as host failure.
SYNOPSIS
C int info = pvm_notify( int what, int msgtag, int cnt, int *tids )
Fortran call pvmfnotify( what, msgtag, cnt, tids, info )
PARAMETERS
what Type of event to trigger the notification. Presently one of:
Value Meaning
PvmTaskExit Task exits or is killed
PvmHostDelete Host is deleted or crashes
PvmHostAdd New host is added
msgtag Message tag to be used in notification.
cnt For PvmTaskExit and PvmHostDelete, specifies the length of the tids array. For PvmHostAdd, specifies the number of times to
notify.
tids For PvmTaskExit and PvmHostDelete, an array of length cnt of task or pvmd TIDs to be notified about. The array is not used with
the PvmHostAdd option.
info Integer status code returned by the routine. Values less than zero indicate an error.
DESCRIPTION
The routine pvm_notify requests PVM to notify the caller on detecting certain events. One or more notify messages (see below) are sent by
PVM back to the calling task. The messages have tag msgtag supplied to notify.
The notification messages have the following format:
PvmTaskExit
One notify message for each TID requested. The message body contains a single TID of exited task.
PvmHostDelete
One notify message for each TID requested. The message body contains a single pvmd-TID of exited pvmd.
PvmHostAdd
cnt notify messages are sent, one each time the local pvmd's host table is updated. The message body contains an integer length
followed by a list of pvmd-TIDs of new pvmds. The counter of PvmHostAdd messages yet to be sent is replaced by successive calls to
pvm_notify. Specifying a cnt of -1 turns on PvmHostAdd messages until a future notify; a count of zero disables them.
TIDs in the notify messages are packed as integers.
The calling task is responsible for receiving messages with the specified tag and taking appropriate action.
Future versions of PVM may expand the list of available notification events.
EXAMPLES
C:
info = pvm_notify( PvmTaskExit, 9999, ntask, tids );
Fortran:
CALL PVMFNOTIFY( PVMHOSTDELETE, 1111, NUMHOSTS, DTIDS, INFO )
To "cancel" a notify request in PVM, the pvm_notify routine can be re-invoked with an additional PvmNotifyCancel flag in the what argument.
The remaining arguments to this cancelling invocation must match the original invocation exactly, aside from the additional PvmNotifyCancel
which can be added(+) or OR-ed(|) to the what argument:
pvm_notify( PvmTaskExit, 9999, ntask, tids );
. . .
pvm_notify( PvmTaskExit | PvmNotifyCancel, 9999, ntask, tids );
Note that when a notify is cancelled, the notify message is delivered, as if the given event (i.e. task exit, host add or delete) had
occurred.
ERRORS
PvmSysErr
pvmd not responding.
PvmBadParam
giving an invalid argument value.
SEE ALSO
pvm_tasks(3PVM), pvm_config(3PVM)
31 January, 1994 NOTIFY(3PVM)