Sponsored Content
Full Discussion: if elif control issue
Top Forums Shell Programming and Scripting if elif control issue Post 302581094 by zaxxon on Monday 12th of December 2011 04:44:58 AM
Old 12-12-2011
You did not understand. Your code is
Code:
elif [ $DB_SYSTEM = "MYSQL" ]

The debugging output of this test is
Code:
+ [ MYSQL = ORACLE ]

So everything is going right. It only enters the elif block if the condition is true, which is not the case and so skips the elif block. If this is really a MYSQL system, then your variable seems to have a wrong value, wherever it is set.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

elif not expected

Hi, I have a shell script which runs fine when i do it from Unix simulator on Widnows. When i try to run the same for Unix it throws me the error syntax error at line 87: `elif' unexpected. Piece of code for the same is while do if ; then shift configFile="$1"... (9 Replies)
Discussion started by: pv0428
9 Replies

2. Shell Programming and Scripting

If..elif..else...fi

Hi all, I got some problems on executing the following scripts. Scripts: if ]; then echo "M${str}O 0 1" >> ${tempFile} elif ]; then echo "M${str}O 1 0" >> ${tempFile} else echo "M${str}O 0 0" >> ${tempFile} fi Error: "`;' is not expected." what's the problem? (2 Replies)
Discussion started by: Rock
2 Replies

3. UNIX for Dummies Questions & Answers

Odd Control Character issue ^A

Sorry to bug you, but my sed is failing me, I have a file auto generated from abinitio, it has a string of chars ending with a line break, and then it has added a ^A character, I can remove this is vi by using the following %s/^A//g (where ^A is ctrl v and control A), however when I try to sed... (1 Reply)
Discussion started by: badg3r
1 Replies

4. Shell Programming and Scripting

If -elif-else error.

I am getting below error from this code (which is at line 24): if ] #this is line24 in code then mv $File_source_path/$File_name $File_name'_'`date '+%d%m%y'` Error: line 24: Any help with the syntax. I am putting 2 condition with 'AND' clause. This is bash shell. (2 Replies)
Discussion started by: amit.mathur08
2 Replies

5. SuSE

Installin Suse 11 - Mouse issue using Remote Control

hi guys I want to exhaust all the possibilities so I'm going to ask this here I am installing a Suse 11 on IBM Blade Center using Remote Control. when using this is impossible to use the mouse I see the mouse but I have no control over it I try to move it but no way it moves to fast s no... (3 Replies)
Discussion started by: kopper
3 Replies

6. Homework & Coursework Questions

if/elif help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: This is my problem for the class. Write a script that asks for the user's age. If it is equal to or higher... (6 Replies)
Discussion started by: aggie6970
6 Replies

7. UNIX for Advanced & Expert Users

if else elif

Hi all,i have configured the following script to check if the file exists or not, #!/bin/sh sleep 30 { FILEFULL=$1`date +$2`* if ; then echo $FILEFULL exist else echo "$FILEFULL File not Found" | mail -s 'server' myaccount@mydomain.com fi } but i have a problem, i need to... (2 Replies)
Discussion started by: charli1
2 Replies

8. Shell Programming and Scripting

If / elif

Hello all, I have a scenario where I take user input values and accordingly take actions say I run a script with sh scriptname -x GB -e txt (txt can also be text) I have used if clause for the first input (-x GB)and it is working fine Now for second the scenario is if then echo... (3 Replies)
Discussion started by: nnani
3 Replies

9. Shell Programming and Scripting

Issue with condition "if then elif else fi"

Hi everybody, I must get trought a shell script 3 arguments. 1st argument = $1 (can take values REP1..4) 2nd argument = $2 (can take values A..Z) 3rd arguement = $3 (also can take values A...Z) I've written this code : #!/bin/bash if then liste=/data/folder1 echo... (6 Replies)
Discussion started by: shellX
6 Replies
UNIFDEF(1)							Programmer's Manual							UNIFDEF(1)

NAME
unifdef, unifdefall -- remove preprocessor conditionals from code SYNOPSIS
unifdef [-bBcdeKknsStV] [-Ipath] [-Dsym[=val]] [-Usym] [-iDsym[=val]] [-iUsym] ... [-o outfile] [infile] unifdefall [-Ipath] ... file DESCRIPTION
The unifdef utility selectively processes conditional cpp(1) directives. It removes from a file both the directives and any additional text that they specify should be removed, while otherwise leaving the file alone. The unifdef utility acts on #if, #ifdef, #ifndef, #elif, #else, and #endif lines. A directive is only processed if the symbols specified on the command line are sufficient to allow unifdef to get a definite value for its control expression. If the result is false, the directive and the following lines under its control are removed. If the result is true, only the directive is removed. An #ifdef or #ifndef directive is passed through unchanged if its controlling symbol is not specified on the command line. Any #if or #elif control expression that has an unknown value or that unifdef cannot parse is passed through unchanged. By default, unifdef ignores #if and #elif lines with constant expressions; it can be told to process them by specifying the -k flag on the command line. It understands a commonly-used subset of the expression syntax for #if and #elif lines: integer constants, integer values of symbols defined on the command line, the defined() operator, the operators !, <, >, <=, >=, ==, !=, &&, ||, and parenthesized expressions. A kind of ``short circuit'' evaluation is used for the && operator: if either operand is definitely false then the result is false, even if the value of the other operand is unknown. Similarly, if either operand of || is definitely true then the result is true. In most cases, the unifdef utility does not distinguish between object-like macros (without arguments) and function-like arguments (with arguments). If a macro is not explicitly defined, or is defined with the -D flag on the command-line, its arguments are ignored. If a macro is explicitly undefined on the command line with the -U flag, it may not have any arguments since this leads to a syntax error. The unifdef utility understands just enough about C to know when one of the directives is inactive because it is inside a comment, or affected by a backslash-continued line. It spots unusually-formatted preprocessor directives and knows when the layout is too odd for it to handle. A script called unifdefall can be used to remove all conditional cpp(1) directives from a file. It uses unifdef -s and cpp -dM to get lists of all the controlling symbols and their definitions (or lack thereof), then invokes unifdef with appropriate arguments to process the file. OPTIONS
-Dsym=val Specify that a symbol is defined to a given value which is used when evaluating #if and #elif control expressions. -Dsym Specify that a symbol is defined to the value 1. -Usym Specify that a symbol is undefined. If the same symbol appears in more than one argument, the last occurrence dominates. -b Replace removed lines with blank lines instead of deleting them. Mutually exclusive with the -B option. -B Compress blank lines around a deleted section. Mutually exclusive with the -b option. -c If the -c flag is specified, then the operation of unifdef is complemented, i.e., the lines that would have been removed or blanked are retained and vice versa. -d Turn on printing of debugging messages. -e Because unifdef processes its input one line at a time, it cannot remove preprocessor directives that span more than one line. The most common example of this is a directive with a multi-line comment hanging off its right hand end. By default, if unifdef has to process such a directive, it will complain that the line is too obfuscated. The -e option changes the behaviour so that, where pos- sible, such lines are left unprocessed instead of reporting an error. -K Always treat the result of && and || operators as unknown if either operand is unknown, instead of short-circuiting when unknown op- erands can't affect the result. This option is for compatibility with older versions of unifdef. -k Process #if and #elif lines with constant expressions. By default, sections controlled by such lines are passed through unchanged because they typically start ``#if 0'' and are used as a kind of comment to sketch out future or past development. It would be rude to strip them out, just as it would be for normal comments. -n Add #line directives to the output following any deleted lines, so that errors produced when compiling the output file correspond to line numbers in the input file. -o outfile Write output to the file outfile instead of the standard output. If outfile is the same as the input file, the output is written to a temporary file which is renamed into place when unifdef completes successfully. -s Instead of processing the input file as usual, this option causes unifdef to produce a list of symbols that appear in expressions that unifdef understands. It is useful in conjunction with the -dM option of cpp(1) for creating unifdef command lines. -S Like the -s option, but the nesting depth of each symbol is also printed. This is useful for working out the number of possible com- binations of interdependent defined/undefined symbols. -t Disables parsing for C comments and line continuations, which is useful for plain text. -iDsym[=val] -iUsym Ignore #ifdefs. If your C code uses #ifdefs to delimit non-C lines, such as comments or code which is under construction, then you must tell unifdef which symbols are used for that purpose so that it will not try to parse comments and line continuations inside those #ifdefs. You can specify ignored symbols with -iDsym[=val] and -iUsym similar to -Dsym[=val] and -Usym above. -Ipath Specifies to unifdefall an additional place to look for #include files. This option is ignored by unifdef for compatibility with cpp(1) and to simplify the implementation of unifdefall. -V Print version details. The unifdef utility copies its output to stdout and will take its input from stdin if no file argument is given. The unifdef utility works nicely with the -Dsym option of diff(1). EXIT STATUS
The unifdef utility exits 0 if the output is an exact copy of the input, 1 if not, and 2 if in trouble. DIAGNOSTICS
Too many levels of nesting. Inappropriate #elif, #else or #endif. Obfuscated preprocessor control line. Premature EOF (with the line number of the most recent unterminated #if). EOF in comment. SEE ALSO
cpp(1), diff(1) HISTORY
The unifdef command appeared in 2.9BSD. ANSI C support was added in FreeBSD 4.7. AUTHORS
The original implementation was written by Dave Yost <Dave@Yost.com>. Tony Finch <dot@dotat.at> rewrote it to support ANSI C. BUGS
Expression evaluation is very limited. Preprocessor control lines split across more than one physical line (because of comments or backslash-newline) cannot be handled in every situation. Trigraphs are not recognized. There is no support for symbols with different definitions at different points in the source file. The text-mode and ignore functionality does not correspond to modern cpp(1) behaviour. January 18, 2011
All times are GMT -4. The time now is 01:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy