Sponsored Content
Top Forums Shell Programming and Scripting New to UNIX like 2 weeks of study only Post 302922708 by bakunin on Monday 27th of October 2014 09:58:51 PM
Old 10-27-2014
Quote:
Originally Posted by Gmoney93079
then if name is equal to name do nothing, but if name is != name do something
We have undestood that, but: "if name is equal to name" is true regardless of the value of "name", so the condition is moot. You could have written "if 1 equals 1" for the same effect.

For any if-else-decision to make sense there must be a condition which is sometimes true, sometimes not true. If it is always true or always not true, then you do not need a condition at all. If i say to you "if the time is in the evening then go to sleep, otherwise get up" there is a condition (what the time is) and sometimes this will be "in the evening", sometimes not, resulting in "get up" sometimes and in "go to sleep" otherwise.

What you do is "if the time is any time then get up" - but you do not need to refer to the time at all in such a case, because its value would be irrelevant anyways.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I want to start study Unix!

hello .. I am college student and a new guy to unix. I have a simple question: what does "unix" stand for ,or just a meaningless name ? (4 Replies)
Discussion started by: nanuo
4 Replies

2. UNIX for Dummies Questions & Answers

i want to study unix,but it is very dificult.

14 (2 Replies)
Discussion started by: zbweh5280
2 Replies

3. UNIX for Dummies Questions & Answers

help for unix study

hi I am vijay how r the unix gurus? I want to install unix for our sites.So pls tell me abt unix installation user guide & also all the unix commands.Pls help me.I am waiting for yr reply. bye..........vijay :D (2 Replies)
Discussion started by: vi77_surat
2 Replies

4. Programming

Good Unix Online Study Material

HI Friends, I wanted to start this thread inorder to keep all the Unix starters to easily find useful material through this thread...I request you all to provide with the URL address of any gud material you know... thanks and regards... (2 Replies)
Discussion started by: rahul3894singh
2 Replies

5. UNIX for Dummies Questions & Answers

Any study material for begineers for UNIX please??

Any study material for begineers for UNIX please?? (2 Replies)
Discussion started by: niranjany
2 Replies

6. UNIX for Dummies Questions & Answers

Unix study help

Hi, I need some help with the follow questions :(. Any help would be great! Answer with the necessary commands 1. In your login directory, make a directory called week4/revision 2. Without changing directories, make another directory week4_revision/data 3. Change to week4_revision/data... (2 Replies)
Discussion started by: Heyo
2 Replies

7. What is on Your Mind?

UNIX Admin (Papers and study material)

Hi, I want to prepare and then appear for Unix admin certification. Please guide me for the study material and Exams that are required to be taken for UNIX certifcation. Thanks in advance. (11 Replies)
Discussion started by: raman1605
11 Replies

8. Programming

UNIX- -Case study - Library management.

Hi.. I am a new joinee to this foram.I need to submit a case study in UNIX .Please help me to submit the case study by giving your valuable ideas.It will be very helpful for me. Topic: Unix File Management A university wants to computerize its Library operations because of... (2 Replies)
Discussion started by: viji_jeya
2 Replies

9. UNIX for Dummies Questions & Answers

UNIX Study Material

Hi , Can anyone suggest me any UNIX Study material and UNIX Certification specific for TELECOM-DOMAIN. Best Regards, Om Prakash. (14 Replies)
Discussion started by: omprakash1986
14 Replies

10. SCO

Study UNIX Kernel

Hi all, I hope you are fine, I'd like study Os I tried a book like Silberschatz it's a good book but like other books it talks about the concepts abstractly and that's due to it try to encompass many concepts from many operating systems in GENERAL. i am not too much comfortable from these... (20 Replies)
Discussion started by: Abdo_8008
20 Replies
poll(2) 							System Calls Manual							   poll(2)

NAME
poll - monitor I/O conditions on multiple file descriptors SYNOPSIS
DESCRIPTION
provides a general mechanism for reporting I/O conditions associated with a set of file descriptors and for waiting until one or more spec- ified conditions becomes true. Specified conditions include the ability to read or write data without blocking, and error conditions. Arguments fds Points to an array of structures, one for each file descriptor of interest. nfds Specifies the number of structures in the fds array. timeout Specifies the maximum length of time (in milliseconds) to wait for at least one of the specified conditions to occur. Each structure includes the following members: File descriptor Requested conditions Reported conditions The member of each structure specifies an open file descriptor. The function uses the member to determine what conditions to report for this file descriptor. If one or more of these conditions is true, sets the associated member. ignores any structure whose member is negative. If the member of all structures is negative, returns 0 and has no other results. The and members of the structure are bit masks. The calling process sets the bit mask, and sets the bit masks. These bit masks contain ORed combinations of condition flags. The following condition flags are defined: Data can be read without blocking. For streams, this flag means that a message that is not high priority is at the front of the stream head read queue. This message can be of zero length. Synonym for A high priority message is available. For streams, this message can be of zero length. Data can be written without blocking. For streams, this flag specifies that normal data (not high priority or priority band > 0) can be written with- out being blocked by flow control. This flag is not used for high priority data, because it can be written even if the stream is flow controlled. An error has occurred on the file descriptor. The device has been disconnected. For streams, this flag in is mutually exclusive with since a stream cannot be written to after a hangup occurs. This flag and and are not mutually exclusive. is not a valid file descriptor. A non-priority message is available. For streams, this flag means that a normal message (not high priority or priority band > 0) is at the front of the stream head read queue. This message can be of zero length. A priority message (priority band > 0) is at the front of the stream head read queue. This message can be read without blocking. The message can be of zero length. Same as Priority data (priority band > 0) can be written without being blocked by flow control. Only previously written bands are checked. A or message specifying has reached the front of the stream head read queue. The conditions indicated by and are true if and only if at least one byte of data can be read or written without blocking. The exception is regular files, which always poll true for and Also, streams return in even if the available message is of zero length. The condition flags and are always set in if the conditions they indicate are true for the specified file descriptor, whether or not these flags are set in For each call to the set of reportable conditions for each file descriptor consists of those conditions that are always reported, together with any further conditions for which flags are set in If any reportable condition is true for any file descriptor, returns with flags set in for each true condition for that file descriptor. If no reportable condition is true for any of the file descriptors, waits up to timeout milliseconds for a reportable condition to become true. If, in that time interval, a reportable condition becomes true for any of the file descriptors, reports the condition in the file descriptor's associated member and returns. If no reportable condition becomes true, returns without setting any bit masks. If the timeout parameter is a value of -1, does not return until at least one specified event has occurred. If the value of the timeout parameter is 0, does not wait for an event to occur but returns immediately, even if no specified event has occurred. The behavior of is not affected by whether the flag is set on any of the specified file descriptors. RETURN VALUE
Upon successful completion, returns a nonnegative value. If the call returns 0, has timed out and has not set any of the bit masks. A positive value indicates the number of file descriptors for which has set the bit mask. If fails, it returns -1 and sets to indicate the error. ERRORS
fails if any of the following conditions are encountered: Allocation of internal data structures failed. A later call to may complete successfully. A signal was delivered before any of the selected for conditions occurred or before the time limit expired. One of the following conditions is true: o timeout is a negative number other than -1. o The nfds argument is less than 0, greater than or greater than or equal to The kernel parameter specifies the max- imum number of file descriptors per process (see maxfiles(5)). specifies the maximum number of files a process can have open at one time; it has a value of 2048 if the resource limit for a process is less than or equal to 2048. o One of the specified file descriptor refers to a stream or mux that is linked downstream from a mux. The fds parameter in conjunction with the nfds parameter addresses a location outside of the allocated address space of the process. Reliable detection of this error is implementation-dependent. EXAMPLES
Wait for input on file descriptor 0: Wait for input on and output on giving up after 10 seconds: Check for input or output on file descriptor 5 without waiting: Wait 3.5 seconds: Wait for a high priority, priority, or normal message on streams file descriptor 0: SEE ALSO
read(2), write(2), select(2), getmsg(2), putmsg(2), streamio(7). STANDARDS CONFORMANCE
poll(2)
All times are GMT -4. The time now is 05:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy