Sponsored Content
Full Discussion: A little help please
Top Forums Shell Programming and Scripting A little help please Post 302145561 by immyakram on Wednesday 14th of November 2007 03:56:46 PM
Old 11-14-2007
Thing is i understand evrything to that point but then when i get onto stuff liek testing with conditions - testing charachter data, testing numeric data and testing for files. Let me give you an example if you explain this little part would be great.

Although test is most often used for decision making, it can also be used on its own as follows

$ str1=abcd
$ test $str1 = abcd
$ echo $?
0


Note: unlike the variable assignment statement in the first line in the preceding example, the test command must have the equal sign surrounded by white space.

In this example, the shell sends three arguments to test. Strings must be equivalent in both length and character by character.

$ str1="abcd "
$ test "$str1" = abcd
$ echo
$?
1
 
STRCOLL(3)								 1								STRCOLL(3)

strcoll - Locale based string comparison

SYNOPSIS
int strcoll (string $str1, string $str2) DESCRIPTION
Note that this comparison is case sensitive, and unlike strcmp(3) this function is not binary safe. strcoll(3) uses the current locale for doing the comparisons. If the current locale is C or POSIX, this function is equivalent to str- cmp(3). PARAMETERS
o $str1 - The first string. o $str2 - The second string. RETURN VALUES
Returns < 0 if $str1 is less than $str2; > 0 if $str1 is greater than $str2, and 0 if they are equal. CHANGELOG
+--------+------------------------------------+ |Version | | | | | | | Description | | | | +--------+------------------------------------+ | 4.2.3 | | | | | | | This function now works on win32. | | | | +--------+------------------------------------+ SEE ALSO
preg_match(3), strcmp(3), strcasecmp(3), substr(3), stristr(3), strncasecmp(3), strncmp(3), strstr(3), setlocale(3). PHP Documentation Group STRCOLL(3)
All times are GMT -4. The time now is 01:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy