C is not a scripting language, you can't cavalierly assign a string into an integer and expect to get anything sensible. If you try and force it with typecasting, it will take you completely literally and put the wrong type in, giving you results you didn't expect at best and crashing your program at worst.
Greetings,
I am wrapping the monitoring commands like vmstat, sar, iostat and call via arguments
I want ./unix_stats.sh -v vmstat -p <SEC> -d <Duration>
to give vmstat values, and similarly iostat etc.,.
Also if I give ./unix_stats.sh -v vmstat -i iostat -p <SEC> -d <Duration> should give... (4 Replies)
Hi All,
i have script like below..
echo "1) first option"
echo ""
echo "2) second option"
echo ""
echo "*) please enter the correct option"
read select
case $select in
1) echo "first option selected"
;;
2) echo "second option selected"
;;
*) echo "please enter the correct... (4 Replies)
Hi all
First of all thanks for everyone to read by doubt.Am beginner in shell scripting
Following are my doubts
i have to pass an argument to shellscript how can i do that
second i have to test the argument and shows error when nothing is passes
third i have to match exact argument... (3 Replies)
Hello all,
New to C and I'm trying to write a program which can run a unix command. Would like to have the option of giving the user the ability to enter arguments e.g for "ls" be able to run "ls -l".
I would appreciate any help.
Thanks
#include <stdio.h>
#include <unistd.h>
#include... (3 Replies)
Hi Folks
I have got to the point where I can specify the arguments but how to pass an option is still mystery to me. Example:
temp.csh a b c d
set temp1 = $argv
set temp2 = $argv
set temp3 = $argv
echo $temp1
a
echo $temp2
b
echo $temp3
c d
I WANT:
temp.csh a b c d -S 1
set temp1... (2 Replies)
Hi all:
I'm trying to pass an argument to a command but it's being difficult.
#!/bin/bash
set -xv
if ; then
echo "More than 1 argument entered"
echo "Please enter a month using 3 character names, ie, Jan, Mar, Apr, Dec" && exit 1
fi
if ; then
echo "Please enter a month using... (2 Replies)
Hi,
I have a script that is scheduled with cron and runs every night. The cron part looks like this:
00 20 * * 0,1,2,3,4,5,6 /usr/local/bin/BACKUP TBTARM HOT DELETE
My issue is with the 3rd parameter. Somewhere in the script, i want to tell the script to delete some files if the 3rd... (7 Replies)
How to pass the alphabet character as a argument in case and in if block?
ex:
c=$1
if a-z ]]
then
echo "alphabet"
case $1 in
a-z) echo "the value is a alphabet"
edit by bakunin: please use CODE-tags. We REALLY mean it. (9 Replies)
Hi
I have a script which am trying to pass an argument which am trying to call using $1 but its not taking the value inside the if loop as it showing the error as if: Empty if..
Any help on this will be helpful.
#!/usr/bin/csh
echo $1
if ('$1' == "pp")
then
echo "Printing $1"
endif (4 Replies)
I am trying to pass a second argument like so:
if ] then
export ARG2=$2
else
message "Second argument not specified: USAGE - $PROGRAM_NAME ARG1 ARG2"
checkerror -e 2 -m "Please specify if it is a history or weekly (H or W) extract in the 2nd argument"
fi
however, it always goes... (4 Replies)
Discussion started by: MIA651
4 Replies
LEARN ABOUT PHP
maxdb_field_count
MAXDB_FIELD_COUNT(3) 1 MAXDB_FIELD_COUNT(3)maxdb_field_count - Returns the number of columns for the most recent query
Procedural style
SYNOPSIS
int maxdb_field_count (resource $link)
DESCRIPTION
Object oriented style
int maxdb::field_count (void )
Returns the number of columns for the most recent query on the connection represented by the $link parameter. This function can be useful
when using the maxdb_store_result(3) function to determine if the query should have produced a non-empty result set or not without knowing
the nature of the query.
RETURN VALUES
An integer representing the number of fields in a result set.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
maxdb_report (MAXDB_REPORT_OFF);
$maxdb->query("DROP TABLE friends");
maxdb_report (MAXDB_REPORT_ERROR);
$maxdb->query( "CREATE TABLE friends (id int, name varchar(20))");
$maxdb->query( "INSERT INTO friends VALUES (1,'Hartmut')");
$maxdb->query( "INSERT INTO friends VALUES (2, 'Ulf')");
if ($maxdb->field_count()) {
/* this was a select/show or describe query */
$result = $maxdb->store_result();
/* process resultset */
$row = $result->fetch_row();
/* free resultset */
$result->close();
}
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
maxdb_report (MAXDB_REPORT_OFF);
maxdb_query($link,"DROP TABLE friends");
maxdb_report (MAXDB_REPORT_ERROR);
maxdb_query($link, "CREATE TABLE friends (id int, name varchar(20))");
maxdb_query($link, "INSERT INTO friends VALUES (1,'Hartmut')");
maxdb_query($link, "INSERT INTO friends VALUES (2, 'Ulf')");
if (maxdb_field_count($link)) {
/* this was a select/show or describe query */
$result = maxdb_store_result($link);
/* process resultset */
$row = maxdb_fetch_row($result);
/* free resultset */
maxdb_free_result($result);
}
/* close connection */
maxdb_close($link);
?>
The above example produces no output.
PHP Documentation Group MAXDB_FIELD_COUNT(3)