I'm writing an argument checking block and running into an error. I want to confirm that $1 is one of two values. Here is what I have:
Code:
if [[ "$1" != ("-e" || "-d") ]]; then
echo -e "\nPlease check your first augument. You used \"$1\"
which is not recognized. Please see usage:"
usage
exit 1
else
echo -e "\narg 1 is good to go.."
fi
Can anyone point me in the right direction? Any help is greatly appreciated.
In a script , i would like to check if the argument ( $1, $2 inside the script) contain wildcard (*,? etc). how do i do it?
> script_name arg1 arg*
$1 (arg1) does not contain wildcard, but $2 (arg* )contains wildcard. how can i tell in script?
i need to do this is because :
if arg1... (3 Replies)
How do I check if the argument passed to a script is an integer?
I am writting a script that will take to integers and want to be able to check before I go on.
I am using bourne shell.
Thanks in advance (13 Replies)
I have a script that when called can have 1 or 2 command arguments. If only 1 command argument is passed into the script how can I check that the second argument is null? I am working in Korn shell in a UNIX environment.
Example of script call with 2 arguments:
% statreport 0300 1430
... (6 Replies)
I am passing a string as argument. Need to check if it contains "-".
If it contains "-" then check if it contains "-r" .If Yes then print some message else check if it contains "-t".If yes print some message. How this check can be done using shell script?
How I can do this by using IF OR... (7 Replies)
Can someone please help me with this SHELL script?
I need to create a script that gets a positive number n as an argument. The script must calculate the factorial of its argument. In other words, it must calculate n!=1x2x3x...xn. Note that 0!=1.
Here is a start but I have no clue how to... (3 Replies)
If ($argv == “-debug”) then
Echo “in loop”
Endif
But this is not working. If I modify this code and remove “-“, then it works.
Similarly I am getting problem using grep command also
Grep “-debug” Filename
Can someone please help me on how to resolve these... (1 Reply)
I want to make a script that check for the argument passed to it and generates an error in case any character/string argument passed to it.
I am using below code, but its not working. can anyone help.
#!/bin/bash
if ]; then
echo 'An integer argument is passed to the script hence... (3 Replies)
Hi guys,
I have created a csh script which allows user to pass input argument with the script like:
cluster_on_lev3.csh -t <value> -p <value>
Example:
cluster_on_lev3.csh -t 2.3 -p 0.05
Now I want to create an error code where if user passes input argument without spaces , the code... (16 Replies)
I need a script that should print 'yes' if the argument is a valid shell variable name else 'No' if it is not a valid shell variable. A valid one begins with an alphabet or percentage (%) character and is followed by zero or more alphanumberic or percentage (%) characters.
For example:
$... (6 Replies)
Discussion started by: pingiliarjun
6 Replies
LEARN ABOUT PHP
imap_get_quota
IMAP_GET_QUOTA(3) 1 IMAP_GET_QUOTA(3)imap_get_quota - Retrieve the quota level settings, and usage statics per mailboxSYNOPSIS
array imap_get_quota (resource $imap_stream, string $quota_root)
DESCRIPTION
Retrieve the quota level settings, and usage statics per mailbox.
For a non-admin user version of this function, please see the imap_get_quotaroot(3) function of PHP.
PARAMETERS
o $
imap_stream -An IMAP stream returned by imap_open(3).
o $quota_root
-$quota_root should normally be in the form of user.name where name is the mailbox you wish to retrieve information about.
RETURN VALUES
Returns an array with integer values limit and usage for the given mailbox. The value of limit represents the total amount of space
allowed for this mailbox. The usage value represents the mailboxes current level of capacity. Will return FALSE in the case of failure.
As of PHP 4.3, the function more properly reflects the functionality as dictated by the RFC2087. The array return value has changed to
support an unlimited number of returned resources (i.e. messages, or sub-folders) with each named resource receiving an individual array
key. Each key value then contains an another array with the usage and limit values within it.
For backwards compatibility reasons, the original access methods are still available for use, although it is suggested to update.
EXAMPLES
Example #1
imap_get_quota(3) example
<?php
$mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$quota_value = imap_get_quota($mbox, "user.kalowsky");
if (is_array($quota_value)) {
echo "Usage level is: " . $quota_value['usage'];
echo "Limit level is: " . $quota_value['limit'];
}
imap_close($mbox);
?>
Example #2
imap_get_quota(3) 4.3 or greater example
<?php
$mbox = imap_open("{imap.example.org}", "mailadmin", "password", OP_HALFOPEN)
or die("can't connect: " . imap_last_error());
$quota_values = imap_get_quota($mbox, "user.kalowsky");
if (is_array($quota_values)) {
$storage = $quota_values['STORAGE'];
echo "STORAGE usage level is: " . $storage['usage'];
echo "STORAGE limit level is: " . $storage['limit'];
$message = $quota_values['MESSAGE'];
echo "MESSAGE usage level is: " . $message['usage'];
echo "MESSAGE limit is: " . $message['limit'];
/* ... */
}
imap_close($mbox);
?>
NOTES
This function is currently only available to users of the c-client2000 or greater library.
The given $imap_stream must be opened as the mail administrator, otherwise this function will fail.
SEE ALSO imap_open(3), imap_set_quota(3), imap_get_quotaroot(3).
PHP Documentation Group IMAP_GET_QUOTA(3)