02-15-2005
if [ `echo $1 |grep "WA"` ]; then
echo "Found"
else
echo "Not Found"
fi
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello All,
I have a script that will email out if the email address is specified as parameter 1.
I am using ksh, and then tried the following :
email=$1
Following did not work, I am getting error
test -z $email
test ${email:=" ") -eq " "
test -n $email
test ${?email}
What... (4 Replies)
Discussion started by: negixx
4 Replies
2. Shell Programming and Scripting
I am making a script to check the parameters, but it seems that I can't catch the parameters by loop.
$ cat sendmsg.sh
#!/bin/sh
## Parameter Check
i=0
max=$#
while
do
PARAM=$${i}
i=`expr ${i} + 1`
echo ${PARAM}
done
How can I get the $1, $2, $3 by loop and set their... (2 Replies)
Discussion started by: GCTEII
2 Replies
3. Shell Programming and Scripting
I need to pass a parameter to a function in a script. My parameter is a string. When I display the parameter within my function, I only get the first word from string I pass in.
How can I make the function receive the whole string (and not terminate at the first space it encounters)?.
part of... (1 Reply)
Discussion started by: fastgoon
1 Replies
4. AIX
I have a "find {start} -ls" command listing all files and dirs in on the whole filesystem.
As part of this it lists locations that contain temporary files and, sometimes when executing, it identifies a file but produces an ERROR when trying to list it.
ERROR thrown: find: bad status--... (2 Replies)
Discussion started by: apiggott
2 Replies
5. Shell Programming and Scripting
Hi,
I have a parameter which is a string:
set parameter = "string"
I would like to compare it to various strings inside an IF conditional:
if ($parameter == "string") then
bla bla bla
endif
but it doesn't work, and I have no idea why.
Thanks in advance,
Shira. :) (12 Replies)
Discussion started by: shira
12 Replies
6. UNIX for Advanced & Expert Users
Hi all,
I have four (4) different UNIX flavours and I want to know whether the following commands are correct with respect to wanting to check on what are my current kernel parameter settings.
I just want to clear the doubts hanging over my head whether the commands below are the right ones... (2 Replies)
Discussion started by: newbie_01
2 Replies
7. Shell Programming and Scripting
Hi all
i need to check that if user has passed any input parameter while executing he shell script like
./test1.sh -a"-v"
then do smothing
if user execute the script without giving input paramater then
./test1.sh
then do something
how can we check this input parameter (6 Replies)
Discussion started by: aishsimplesweet
6 Replies
8. Shell Programming and Scripting
Hey I'm new in linux,
I'm looking for a code to check whether the parameter is a number or a string.
I have already tried this code:
eerste=$(echo $1 | grep "^*$">aux)
if
But it doesn't work.:confused:
Thanks (2 Replies)
Discussion started by: Eclecticaa
2 Replies
9. Shell Programming and Scripting
I have a code which is using to find duplicates in a files based on column.Below is the same code which is used to find duplicates in my file based on column 1
awk -F'|' '{if (x) { x_count++; print $0; if (x_count == 1) { print x } } x = $0}' FileName >Dup_File.txt
But my requirement here is... (3 Replies)
Discussion started by: ginrkf
3 Replies
LEARN ABOUT PHP
mssql_fetch_field
MSSQL_FETCH_FIELD(3) MSSQL_FETCH_FIELD(3)
mssql_fetch_field - Get field information
SYNOPSIS
object mssql_fetch_field (resource $result, [int $field_offset = -1])
DESCRIPTION
mssql_fetch_field(3) can be used in order to obtain information about fields in a certain query result.
PARAMETERS
o $result
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
o $field_offset
- The numerical field offset. If the field offset is not specified, the next field that was not yet retrieved by this function is
retrieved. The $field_offset starts at 0.
RETURN VALUES
Returns an object containing field information.
The properties of the object are:
o name - column name. if the column is a result of a function, this property is set to computed#N, where #N is a serial number.
o column_source - the table from which the column was taken
o max_length - maximum length of the column
o numeric - 1 if the column is numeric
o type - the column type.
EXAMPLES
Example #1
mssql_fetch_field(3) example
<?php
// Connect to MSSQL and select the database
mssql_connect('MANGOSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php');
// Send a select query to MSSQL
$query = mssql_query('SELECT * FROM [php].[dbo].[persons]');
// Construct table
echo '<h3>Table structure for 'persons'</h3>';
echo '<table border="1">';
// Table header
echo '<thead>';
echo '<tr>';
echo '<td>Field name</td>';
echo '<td>Data type</td>';
echo '<td>Max length</td>';
echo '</tr>';
echo '</thead>';
// Dump all fields
echo '<tbody>';
for ($i = 0; $i < mssql_num_fields($query); ++$i) {
// Fetch the field information
$field = mssql_fetch_field($query, $i);
// Print the row
echo '<tr>';
echo '<td>' . $field->name . '</td>';
echo '<td>' . strtoupper($field->type) . '</td>';
echo '<td>' . $field->max_length . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
// Free the query result
mssql_free_result($query);
?>
SEE ALSO
mssql_field_seek(3).
PHP Documentation Group MSSQL_FETCH_FIELD(3)