I'm having a question about for loops. (bash)
I have the following for example:
for file in `ls *.txt`
do
read file ...
done
Now when there is a file present there is no problem, now when there is no file present I get the following output in my standard mail box : "No such... (4 Replies)
I'm guessing i have a syntax error. I'm not sure it get's past the the while condition. I get an error 0 not found. Simple loop not sure what I'm doing wrong.
#!/usr/bin/ksh
set -A MtPtArray /u03 /u06
tUbound=${#MtPtArray
}
echo $tUbound
i=0
while ($i -lt $tUbound)
do
print... (4 Replies)
Hi All,
Thanks all of you for the help you provide to me. Well, I have one more problem, where I am trying to pull file system information in the loop and display the filesystem percentege. I am using following code to achive this, nut it's giving the weired output.
My file system is
... (1 Reply)
can some one please tell me what is the problem with my syntax:confused:
I have 100 files in one folder
1. want to read each of the line by line
2. calculate their number of the words between the first word and the last word of each line
3. create file for each file with number of words... (8 Replies)
Hi
I've gotten a plugin script that won't run. I keeps throwing an error at the following line.
for BARCODE_LINE in `cat ${TSP_FILEPATH_BARCODE_TXT} | grep "^barcode"`
do
#something
done
The error reads
... (3 Replies)
Iam having a script which is used to load users and dumpfile in any given schema.Iam trying to autolog the script and have added two fucntion in it.
function init_stdout_redirect {
OUT_LOG=$1
OUT_PIPE=$(mktemp -u)
# Create the output pipe
mkfifo $OUT_PIPE
# Save stdout and... (15 Replies)
I am getting the following error when I am running a script in ksh when trying to execute an if statement comparing two numerical values
tstmb.sh: 1.5321e+08: 0403-057 Syntax error
Below is my code snippet.
#!/bin/ksh
set -x
TODAY=$(date +%y%m%d)
for file in $(ls -rt *.log | tail... (11 Replies)
Hi gurus,
I hit a block when write the script.
I need do while loop, in the loop I have code below.
sqlplus -s abc/abc@abc <<EOF
spool testwhile
select *
from dual;
spool off
exit;
EOF
when I run script with only this code, it works fine.
if I add code as below:
#!/bin/ksh
... (5 Replies)
I have the following code in bash, however "set red frmt" is not displayed.
echo "iarg_rd = $iarg_rd"
iarg_rd="2"
if ; then
echo "Hello World"
fi
if ; then
frmt="${gap}${!frmt_titl_yl}"
elif ; then
frmt="${gap}${!frmt_titl_bk}"
elif ; then
echo... (2 Replies)
hi all,
I created a sh script to import some tables from mysql to hive.
No problem launching it manually, but if I schedule via crontab it returns me an error in the following part:
#create an array containing all the tables for $dbname
query="SELECT table_name FROM information_schema.tables'... (10 Replies)
Discussion started by: mfran2002
10 Replies
LEARN ABOUT PHP
mssql_num_fields
MSSQL_NUM_FIELDS(3)MSSQL_NUM_FIELDS(3)mssql_num_fields - Gets the number of fields in resultSYNOPSIS
int mssql_num_fields (resource $result)
DESCRIPTION mssql_num_fields(3) returns the number of fields in a result set.
PARAMETERS
o $result
- The result resource that is being evaluated. This result comes from a call to mssql_query(3).
RETURN VALUES
Returns the number of fields, as an integer.
EXAMPLES
Example #1
mssql_num_fields(3) example
<?php
// Connect to MSSQL and select the database
$link = mssql_connect('KALLESPCSQLEXPRESS', 'sa', 'phpfi');
mssql_select_db('php', $link);
// Select some data from our database
$data = mssql_query('SELECT [name], [age] FROM [php].[dbo].[persons]');
// Construct a table
echo '<table border="1">';
$header = false;
// Iterate through returned results
while ($row = mssql_fetch_array($data)) {
// Build the table header
if (!$header) {
echo '<thead>';
echo '<tr>';
for ($i = 1; ($i + 1) <= mssql_num_fields($data); ++$i) {
echo '<td>' . ucfirst($row[$i]) . '</td>';
}
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$header = true;
}
// Build the row
echo '<tr>';
foreach($row as $value) {
echo '<td>' . $value . '</td>';
}
echo '</tr>';
}
// Close table
echo '</tbody>';
echo '</table>';
// Clean up
mssql_free_result($data);
mssql_close($link);
?>
SEE ALSO mssql_query(3), mssql_fetch_field(3), mssql_num_rows(3).
PHP Documentation Group MSSQL_NUM_FIELDS(3)