Sponsored Content
Top Forums Shell Programming and Scripting syntax error near unexpected token `elif' Post 302354684 by proactiveaditya on Saturday 19th of September 2009 11:05:47 AM
Old 09-19-2009
syntax error near unexpected token `elif'

what is wrong with the below script:
---------------------------------------------------------------------------------
Code:
#!/bin/bash

echo "Setting JrePath..."
grep -w "export JrePath" /etc/profile
Export_Status=$?
if [ $Export_Status -eq 0 ]
  echo "JrePath declared"
elif [ $Export_Status -gt 0 ]
  echo "JrePath not declared"
  echo "export JrePath=/etc/alternatives/jre" >> /etc/profile
  echo "JrePath declared"
fi

--------------------------------------------------------------------
I am getting the following error:

Code:
jrepath: line 9: syntax error near unexpected token `elif'
jrepath: line 9: `elif [ $Export_Status -gt 0 ]'

Kindly help..

Last edited by Franklin52; 09-19-2009 at 01:01 PM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

syntax error at line 33: `elif` unexpected

#!/bin/sh echo "Choose option: e, d, l, t, p, or x." read option if test $option = e then echo "Filename?" read file if test ! -f $file then echo "No such file" else echo "Yes its a file" fi ... (4 Replies)
Discussion started by: hazy
4 Replies

2. UNIX for Advanced & Expert Users

Syntax error near unexpected token

Hi, When I run the below shell script I'm getting the error " syntax error near unexpected token `" Script: REM :: File Name : Refresh_OTL.bat REM :: Parameters : %1 - Region REM :: : %2 - Cube Type REM :: : REM :: Notes : REM ============================== set ENVIRONMENT... (2 Replies)
Discussion started by: tomailraj
2 Replies

3. Shell Programming and Scripting

Syntax error near unexpected token `done'

Hi all, Here is a simple script that is working in one server and is giving a syntax error in other server. Can somebody help me ? #!/bin/bash # ftp files done < $file errors: I tried..with no success: if ; then (21 Replies)
Discussion started by: Lenora2009
21 Replies

4. Shell Programming and Scripting

syntax error near unexpected token `='

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)
Discussion started by: jaango123
3 Replies

5. Shell Programming and Scripting

Syntax error near unexpected token `}' please help

I'm going mad not being able to get this to work. im assuming its only a simple mistake but its driving me bonkers trying to find it. Please if you can help me it would save me pulling my hair out!! Thanks #!/bin/bash -xv # #Config name="TEST Server" + name='TEST Server'... (6 Replies)
Discussion started by: Fisheh
6 Replies

6. Shell Programming and Scripting

Syntax error near unexpected token 'elif'

Solaris 10 This is my script: #!/bin/bash #Script to print number of users and print list of them NO=`awk < /etc/passwd -F: '{ print $1 }' | wc -l` echo There are $NO users on system. echo "Do you want me to list them? (y or n):" read YORN if ] awk < /etc/passwd -F: '{ print $1 }'... (5 Replies)
Discussion started by: kaustubh
5 Replies

7. Shell Programming and Scripting

Syntax error near unexpected token `('

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)
Discussion started by: iiiiiiiiiii
2 Replies

8. Shell Programming and Scripting

Syntax error near unexpected token `|'

Hi All; I try to write a bash code and I am using command substitution. My code is like: #!/bin/bash IP="10.0.0.1 10.0.0.2" PORT="22 80" USERNAME="admin" SCRIPT_HOST="adminHost" HOME_DIR=/home/admin SCRIPT_DIR=$HOME_DIR/scripts script="sudo /my_remote_script.sh" SSH="/usr/bin/ssh... (7 Replies)
Discussion started by: Meacham12
7 Replies

9. Shell Programming and Scripting

Syntax error near unexpected token `else'

Hello every one!! I don't know where I am going wrong but I am finding it difficult to clear this error of syntax error near unexpected token `else' I am writing a simple shell script to find a file in a directory and if found execute that else return an error to the log file ... (14 Replies)
Discussion started by: masubram
14 Replies

10. Ubuntu

Syntax error near unexpected token `('

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
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 04:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy