Sponsored Content
Full Discussion: if statement code syntax
Top Forums UNIX for Dummies Questions & Answers if statement code syntax Post 302385335 by 2pugs on Thursday 7th of January 2010 09:48:00 PM
Old 01-07-2010
Try running the du command by itself from the command line. I'm thinking it might be outputting something more than just an interger. If so then that's why it's unable to compare it with another interger and so the test fails.

If the output is more spitting out more than just a number, then you might want to pipe it through awk to get the field you need. I would suggest assigning the output to a variable and then using that in your test statement. Let me know what happens.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need explanation for the syntax(code)

Hi I am new to shell script programming... want to know the process of the following: if then echo "$0: missing argument for option(s) :$MISSINGOPTARG" echo "usage" $USAGE" exit 1 fi (1 Reply)
Discussion started by: chandhar
1 Replies

2. Shell Programming and Scripting

Confirming Syntax - IF statement.

Hi All, Has been a while since I was last on, so I hope everyone has been doing fine. ;) Would like to know if the below IF statement syntax is correct for a ksh environment. It's been pushed into live as someone had deleted the development copy(!); not withstanding that, the statement now... (3 Replies)
Discussion started by: Cameron
3 Replies

3. Shell Programming and Scripting

syntax error on if statement

Hi, Can you please help me with this one: I write an "if" statement, something like this: if then echo "big file" else echo "normal file" and I get an error: `'then is not expected Thanks in advance (6 Replies)
Discussion started by: apenkov
6 Replies

4. Shell Programming and Scripting

Syntax error in script with if statement

I'm working on a function in a shell script I'm writing that will eventually take in and print out a list of vendor names and aliases (for my work) Here's the function in question: addvendorandalias () { echo echo -n 'Would you like to create a new vendor list (y or n)? ' read answer... (3 Replies)
Discussion started by: Straitsfan
3 Replies

5. Shell Programming and Scripting

complex if statement syntax without using 'if ..' keyword in ksh.

It saves me lot of typing and space/lines when I do not use full 'if' keyword and construct, instead use .. && <statement> || <statement> that perfectly replaces.. if ; then <statement> else <statement> fi Can I use following syntax when I want to add multiple statements under 'if'... (4 Replies)
Discussion started by: kchinnam
4 Replies

6. Shell Programming and Scripting

Help with if statement syntax

Hi, Is there a way to compare the value in if condition with a list of values. eg . if ] then echo "it's a mammal" else echo "its not" fi Thanks! (8 Replies)
Discussion started by: neil.k
8 Replies

7. Shell Programming and Scripting

If statement Syntax error

Hi Can you please tell me what is wrong with this line: if && ]; then basically i want to check if x = 12 and F (Filename) end with 'g'. But it is throwing syntax error. (7 Replies)
Discussion started by: rtagarra
7 Replies

8. Shell Programming and Scripting

[Solved] 0403-057 Syntax error for if statement

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)
Discussion started by: kiran1112
11 Replies

9. Shell Programming and Scripting

Help with if statement syntax in shell script

I want to make the file test condition a variable ($Prmshn in code below). My goal is to use something like the first three unsuccessful if statetments since the 'if #!/bin/ksh test_input() { Prmshn=${1} InFLNm=${2} ifReq="-$Prmshn $InFLNm" #the following three if statments fail: #if ] ;... (10 Replies)
Discussion started by: ms63707
10 Replies

10. UNIX for Beginners Questions & Answers

Syntax for if statement

I'm new to unix and the command line and am trying to learn different commands. I have a file (teledir.txt) that contains a name and phone number for 3 different people. I am writing a script that is to take two positional parameters and I typed out how it should behave: if <name and number... (1 Reply)
Discussion started by: Eric7giants
1 Replies
CMAP_SET(3)					    Corosync Cluster Engine Programmer's Manual 				       CMAP_SET(3)

NAME
cmap_set - Store value in CMAP SYNOPSIS
#include <corosync/cmap.h> cs_error_t cmap_set (cmap_handle_t handle, const char *key_name, const void *value, size_t value_len, cmap_value_types_t type); Also shortcuts for different types are defined cs_error_t cmap_set_int8(cmap_handle_t handle, const char *key_name, int8_t value); cs_error_t cmap_set_uint8(cmap_handle_t handle, const char *key_name, uint8_t value); cs_error_t cmap_set_int16(cmap_handle_t handle, const char *key_name, int16_t value); cs_error_t cmap_set_uint16(cmap_handle_t handle, const char *key_name, uint16_t value); cs_error_t cmap_set_int32(cmap_handle_t handle, const char *key_name, int32_t value); cs_error_t cmap_set_uint32(cmap_handle_t handle, const char *key_name, uint32_t value); cs_error_t cmap_set_int64(cmap_handle_t handle, const char *key_name, int64_t value); cs_error_t cmap_set_uint64(cmap_handle_t handle, const char *key_name, uint64_t value); cs_error_t cmap_set_float(cmap_handle_t handle, const char *key_name, float value); cs_error_t cmap_set_double(cmap_handle_t handle, const char *key_name, double value); cs_error_t cmap_set_string(cmap_handle_t handle, const char *key_name, const char *value); DESCRIPTION
The cmap_set function is used to store key inside cmap. The handle argument is connection to CMAP database obtained by calling cmap_ini- tialize(3) function. key_name is name of key to set value. Key name is limited by minimal (CMAP_KEYNAME_MINLEN, currently 3) and maximal (CMAP_KEYNAME_MAXLEN, currently 255) length. Also key can contain only limited set of characters expressed by regexp [a-zA-Z0-9._-/:]*. value is pointer to allocated data which will be stored inside CMAP. Length of value (number of bytes) is supplied as value_len parameter. Last parameter is type which gives type of value. It may be one of: CMAP_VALUETYPE_INT8 - 8-bit signed interger CMAP_VALUETYPE_UINT8 - 8-bit unsigned integer CMAP_VALUETYPE_INT16 - 16-bit signed interger CMAP_VALUETYPE_UINT16 - 16-bit unsigned integer CMAP_VALUETYPE_INT32 - 32-bit signed interger CMAP_VALUETYPE_UINT32 - 32-bit unsigned integer CMAP_VALUETYPE_INT64 - 64-bit signed interger CMAP_VALUETYPE_UINT64 - 64-bit unsigned integer CMAP_VALUETYPE_FLOAT - Float value CMAP_VALUETYPE_DOUBLE - Double value CMAP_VALUETYPE_STRING - C-style string CMAP_VALUETYPE_BINARY - Binary data, byte with zero value has no special meaning RETURN VALUE
This call returns the CS_OK value if successful. If value or key_name are unspecified, CS_ERR_INVALID_PARAM is returned. Too short or too long key_name returns CS_ERR_NAME_TOO_LONG error code. Some of keys may be tagged read-only directly in corosync and seting such key will result in CS_ERR_ACCESS error. SEE ALSO
cmap_get(3), cmap_initialize(3), cmap_overview(8) CS_ERR_TRY_AGAIN Resource temporarily unavailable CS_ERR_INVALID_PARAM Invalid argument CS_ERR_ACCESS Permission denied CS_ERR_LIBRARY The connection failed CS_ERR_INTERRUPT System call inturrupted by a signal CS_ERR_NOT_SUPPORTED The requested protocol/functuality not supported CS_ERR_MESSAGE_ERROR Incorrect auth message received CS_ERR_NO_MEMORY Not enough memory to completed the requested task corosync Man Page 23/01/2012 CMAP_SET(3)
All times are GMT -4. The time now is 06:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy