Posting your /etc/passwd here wouldn't be a good idea.
Using several grep processes to read some fields from it is no good idea either. And assigning fields to enumerated variables can exceed the number of variables if you don't exactly know how many data lines you are going to read. Grepping for 5000 just along the line may not be specific enough; unwanted fields may fulfill this condition and give false hits.
Why don't you try sth like
Hi all,
I have a shell script which calls other shell scripts, depending on the input.
Within a.sh, I have a command which calls b.sh (ie. ksh b.sh)
Normally, we use the exit function to terminate a shell. However, if I choose to call exit from b.sh, I will return to the parent shell who... (4 Replies)
Hi All,
I am going through the semaphore concept and have a doubt regarding the same and hope to get a resolution here.
I have a file which has a number of records.
I want to write an application (in C) which will be able to do concurrent read/write on these records.
Of what I have... (8 Replies)
Hi all
This is my first thread here.i confused with the concept of thread.Can anyone tell me this concept in detail.my Quation may be at primary level.
Thanx in advance for help. (1 Reply)
I have the following script running with nohup on one of my servers:
#!/bin/bash
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#set log number
#i=1
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
#Check if log exits, if so incrememnt log number up so we don't clobber
#while... (8 Replies)
Hi all,
This is the basic question.
I have read many books which advised to avoid creating sub shells.
e.g: use wc -l<filename
rather than using cat file|wc -l.
So, how to identify whether a command creates subshell or not?
so,is it better to use tail -n+1 file in stead of using cat.... (3 Replies)
Hi Gurus,
Please help me in below requirement.
Instance =5 (it is user parameter)
total=52 (it is user parameter
i need to split this to 5 and reminder as 1 instances totally 6
for example i need to splitt to each
52/5=10.4
1-10
11-20
21-30
31-40
41-50 (2 Replies)
Hi there,
Everyone knows that errexit is NOT inherited by subshells. But does anyone know why errexit still appears as set with set +o?
The following example highlights the fact that errexit appears set in a subshell (set +o) even though it's actually unset (it does NOT exit with false).
$... (0 Replies)
So i have a script that is like this:
#!/bin/sh
VARA="elementary 1
elementary 2
nursery A
nursery B
highschool AZ"
echo "${ContentOfADifferentSCRIPT}" | sh
i do not have control over the script that is inside the variable "${ContentOfADifferentSCRIPT}".
however, i know that the... (3 Replies)
Discussion started by: SkySmart
3 Replies
LEARN ABOUT PHP
stream_set_timeout
STREAM_SET_TIMEOUT(3) 1 STREAM_SET_TIMEOUT(3)stream_set_timeout - Set timeout period on a streamSYNOPSIS
bool stream_set_timeout (resource $stream, int $seconds, [int $microseconds])
DESCRIPTION
Sets the timeout value on $stream, expressed in the sum of $seconds and $microseconds.
When the stream times out, the 'timed_out' key of the array returned by stream_get_meta_data(3) is set to TRUE, although no error/warning
is generated.
PARAMETERS
o $stream
- The target stream.
o $seconds
- The seconds part of the timeout to be set.
o $microseconds
- The microseconds part of the timeout to be set.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 4.3.0 | |
| | |
| | As of PHP 4.3, this function can (potentially) |
| | work on any kind of stream. In PHP 4.3, socket |
| | based streams are still the only kind supported |
| | in the PHP core, although streams from other |
| | extensions may support this function. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
stream_set_timeout(3) example
<?php
$fp = fsockopen("www.example.com", 80);
if (!$fp) {
echo "Unable to open
";
} else {
fwrite($fp, "GET / HTTP/1.0
");
stream_set_timeout($fp, 2);
$res = fread($fp, 2000);
$info = stream_get_meta_data($fp);
fclose($fp);
if ($info['timed_out']) {
echo 'Connection timed out!';
} else {
echo $res;
}
}
?>
NOTES
Note
This function doesn't work with advanced operations like stream_socket_recvfrom(3), use stream_select(3) with timeout parameter
instead.
This function was previously called as set_socket_timeout(3) and later socket_set_timeout(3) but this usage is deprecated.
SEE ALSO fsockopen(3), fopen(3).
PHP Documentation Group STREAM_SET_TIMEOUT(3)