12-03-2019
@Rudic , Thank u for the details.
For me the last command worked fine. And wondering , can i assign the o/p to two different variables?
that way I can send to an array and list all of them .
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am confused about the output of find command.
Please see the two find commands below.
When i put "*.c" i get lots of files. But when i put *c only i get only one file.
Any answer??
$ find . -name "*c"
./clarify/cheval/hp_server/rulemanager/rulemansvc... (3 Replies)
Discussion started by: shriashishpatil
3 Replies
2. Shell Programming and Scripting
when I do the find command from / , there are a lot of directories that I do not have access to and so I get
"find: cannot open ..."
How can I suppress these messages so only what was found is output.
I was thinking on
find / -name 'searchterm' | grep -v find
but this doesnt work
... (5 Replies)
Discussion started by: JamesByars
5 Replies
3. Shell Programming and Scripting
I'm using the below command to list files older than 2 hours but it returns redundant output, am I missing something.
# find . -mmin +120 -exec ls -l {} \;
total 0
-rw-r--r-- 1 root system 0 Oct 13 09:52 test1
-rw-r--r-- 1 root system 0 Oct 13 09:52 test2
-rw-r--r-- 1 root ... (5 Replies)
Discussion started by: mbak
5 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I am triying to make sure that there exists only one file with the pattern abc* in path /path/. This directory is having many huge files. If there is only one file then I have to take its complete name only to use furter in my script.
I am planning to do like this:
if ; then... (2 Replies)
Discussion started by: new_learner
2 Replies
5. AIX
HI All,
Can anyone send me a command to find TOP 5 Memory consuming process.
It would be lelpful if I get output something like below
processname - pid - memory(in MB) - command
I tried few commands from the internet but the result only give the real memory usage or pagging, I want total... (4 Replies)
Discussion started by: bce_groups
4 Replies
6. Shell Programming and Scripting
Hi all,
I found like top command could be used to find the Memory and CPU utilization. But i want to know how to find the Memory and CPU utilization for a particular user using top command.
Thanks in advance.
Thanks,
Ananthi.U (2 Replies)
Discussion started by: ananthi_ku
2 Replies
7. Shell Programming and Scripting
Hi guys -
I am trying a small script to tell me if there is a file that exists less than 1k. It should report ERROR, otherwise the check is good.
I wrote this script down, however it never runs in the if/then statement. It always returns the echo ERROR.
MYSIZE=$(find /home/student/dir1... (8 Replies)
Discussion started by: DallasT
8 Replies
8. Shell Programming and Scripting
Hi All,
I wanted to show on stdout that a file was found right after it happens due to indicate the activity of long search. Further more I want to store the result of the find in a file.
I have tried this:
echo -n "Searching"
find . -name Makefile -type f -print -exec echo -n "." \; >... (16 Replies)
Discussion started by: vercsab
16 Replies
9. Red Hat
I wanted to know how to find the memory taken by a process using top command. The output of the top command is as follows as an example:
Mem: 13333364k total, 13238904k used, 94460k free, 623640k buffers
Swap: 25165816k total, 112k used, 25165704k free, 4572904k cached
PID USER ... (6 Replies)
Discussion started by: RHCE
6 Replies
LIST(3) 1 LIST(3)
list - Assign variables as if they were an array
SYNOPSIS
array list (mixed $var1, [mixed $...])
DESCRIPTION
Like array(3), this is not really a function, but a language construct. list(3) is used to assign a list of variables in one operation.
PARAMETERS
o $var1
- A variable.
RETURN VALUES
Returns the assigned array.
EXAMPLES
Example #1
list(3) examples
<?php
$info = array('coffee', 'brown', 'caffeine');
// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.
";
// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.
";
// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!
";
// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>
Example #2
An example use of list(3)
<table>
<tr>
<th>Employee name</th>
<th>Salary</th>
</tr>
<?php
$result = $pdo->query("SELECT id, name, salary FROM employees");
while (list($id, $name, $salary) = $result->fetch(PDO::FETCH_NUM)) {
echo " <tr>
" .
" <td><a href="info.php?id=$id">$name</a></td>
" .
" <td>$salary</td>
" .
" </tr>
";
}
?>
</table>
Example #3
Using nested list(3)
<?php
list($a, list($b, $c)) = array(1, array(2, 3));
var_dump($a, $b, $c);
?>
int(1)
int(2)
int(3)
Example #4
Using list(3) with array indices
<?php
$info = array('coffee', 'brown', 'caffeine');
list($a[0], $a[1], $a[2]) = $info;
var_dump($a);
?>
Gives the following output (note the order of the elements compared in which order they were written in the list(3) syntax):
array(3) {
[2]=>
string(8) "caffeine"
[1]=>
string(5) "brown"
[0]=>
string(6) "coffee"
}
NOTES
Warning
list(3) assigns the values starting with the right-most parameter. If you are using plain variables, you don't have to worry about
this. But if you are using arrays with indices you usually expect the order of the indices in the array the same you wrote in the
list(3) from left to right; which it isn't. It's assigned in the reverse order.
Warning
Modification of the array during list(3) execution (e.g. using list($a, $b) = $b) results in undefined behavior.
Note
list(3) only works on numerical arrays and assumes the numerical indices start at 0.
SEE ALSO
each(3), array(3), extract(3).
PHP Documentation Group LIST(3)