05-07-2010
It worked
I was anticipating some function. Not sure what this line is doing:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
What is the differnece between chomp and chop in perl? (1 Reply)
Discussion started by: seismic_willy
1 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I would like to know given that i have two columns and I would like to take the positive integer of the differences between the two columns.
which means |3-2|=1; |2-3|=1 as well.
I would like to know do Bash recognize | | as well for this purposes?
Thanks.
-Jason (2 Replies)
Discussion started by: ahjiefreak
2 Replies
3. Shell Programming and Scripting
When reading over some perl code in a software document, I came across an assignment statement like this
$PATH = ${PROJECT}/......./....
In this particular form of scalar variable assignment, what does the curly braces operators do ? Also, what is the benefit in doing scalar assignment this... (3 Replies)
Discussion started by: JamesGoh
3 Replies
4. Shell Programming and Scripting
Hello:
I have the following perl script which is giving me trouble inside the second elsif statement. The purpose of the script is to go through a file and print out only those lines which contain pertinent information. The tricky part came when I realized that certain items actually spanned... (5 Replies)
Discussion started by: erichpowell
5 Replies
5. Shell Programming and Scripting
I'm almost pulling out my hair trying to figure out what's wrong with this... there's no reason I can see that it shouldn't be working. It seems that the code acts as though the conditional statement is true no matter what - I've even tried removing the negation operator, but it always goes into... (5 Replies)
Discussion started by: wildbluefaerie
5 Replies
6. Shell Programming and Scripting
I know that when using 'while (<FILE>) {}', Perl reads only one line of the file at one time, and store it in '$_'.
Can I change some parameters so that 'while (<>) {}' can read more than one lines, like 2 or 5 lines at one time?
Thanks for the help! (1 Reply)
Discussion started by: zx1106
1 Replies
7. Shell Programming and Scripting
Hello,
I am not sure, where I am missing in the scirpt, I am trying to grep few users from /etc/passwd file and if exists, I added line to echo as user exist, if not create it.
#!/bin/bash
for vid in v707 z307 z496 z163 z292 ; do
if
then
echo " $vid User exists "
else
... (2 Replies)
Discussion started by: bobby320
2 Replies
8. Shell Programming and Scripting
Hello All,
Alright, so this is driving me absolutely insane. I can't seem to find this ANYWHERE...
I've tried every combination and synonym I can think of for this trying to search Google.
What is the Expect/Tcl equivalent to Perl and Bash's "=~" operator, (i.e. the "contains" operator).... (2 Replies)
Discussion started by: mrm5102
2 Replies
9. Shell Programming and Scripting
Hello, can you please help me because I am totally confused with a simple script:
#!/bin/bash
] || ] && echo "Good Morning"
] || ] && echo "Good Night"
For me, these two strings are indentical: false || false and there is no point to execute echo command.
But the run result is... (5 Replies)
Discussion started by: AndreiM
5 Replies
10. Shell Programming and Scripting
I have a little code block (executing on AIX 7.1) that I cannot understand why the NOTFREE=0 does not appear to be assigned even though it goes through that block. This causes a unary operator issue.
#!/bin/bash
PLATFORM="AIX"
NEEDSPC=3000
set -x
if ; then
lsvg | grep -v rootvg | while... (6 Replies)
Discussion started by: port43
6 Replies
STRCSPN(3) 1 STRCSPN(3)
strcspn - Find length of initial segment not matching mask
SYNOPSIS
int strcspn (string $str1, string $str2, [int $start], [int $length])
DESCRIPTION
Returns the length of the initial segment of $str1 which does not contain any of the characters in $str2.
PARAMETERS
o $str1
- The first string.
o $str2
- The second string.
o $start
- The start position of the string to examine.
o $length
- The length of the string to examine.
RETURN VALUES
Returns the length of the segment as an integer.
EXAMPLES
Example #1
strcspn(3) example
<?php
$a = strcspn('abcd', 'apple');
$b = strcspn('abcd', 'banana');
$c = strcspn('hello', 'l');
$d = strcspn('hello', 'world');
var_dump($a);
var_dump($b);
var_dump($c);
var_dump($d);
?>
The above example will output:
int(0)
int(0)
int(2)
int(2)
NOTES
Note
This function is binary-safe.
SEE ALSO
strspn(3).
PHP Documentation Group STRCSPN(3)