Error in ksh script: missing right bracket


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Error in ksh script: missing right bracket
# 1  
Old 09-14-2019
Error in ksh script: missing right bracket

I have no idea how to write ksh script, but i'm really in need of help with this. I using fedora 30 and in attempt of runnig attached script i getting those errors, i solved first error by removing excess bracket, but i do not know what should i do with other. Pls sorry for trash post.

Error in ksh script: missing right bracket-photo_2019-09-13_18-03-45jpg


Error in ksh script: missing right bracket-screenshot-2019-09-14-19-03-26png
# 2  
Old 09-15-2019
Your attachment is really "hard on the eyes" and difficult to read.

Please cut-and-paste your code in your reply, wrapping your reply in code tags.

Thanks.
# 3  
Old 09-15-2019
Code:
#!/bin/sh

if [ ! -x "$1" ];
then
	echo "Usage: sudo $0 <path-to-ug_install-script>"
	echo "for example: sudo $0 /tmp/SIEMENS/nx100/ug_install"
	exit 0
fi

echo 
echo Bypassing Siemens PLM NX Linux distro check....
echo by TeAM SolidSQUAD-SSQ
echo 

mkdir /tmp/bin

cat <<EOF > /tmp/bin/grep
#!/bin/sh
GREP_PATH=

if [ -x /bin/grep ];
then
	GREP_PATH=/bin/grep
fi

if [ -x /usr/bin/grep ];
then
	GREP_PATH=/usr/bin/grep
fi

if [ ! -z \`echo \${1+"\$@"} | \$GREP_PATH -ioe "/proc/version"\` ] && [ ! -z "\`echo \${1+"\$@"} | \$GREP_PATH -ioe "RED HAT"\`" ];
then
	exit 0
fi

\$GREP_PATH \${1+"\$@"}<&0
EOF

chmod +x /tmp/bin/grep
PATH=/tmp/bin:$PATH "$1"
RES=$?

echo "Setup Ended: $RES"
rm -rf /tmp/bin

exit 0

And (see attachment) that's the errors i got...

Error in ksh script: missing right bracket-photo_2019-09-13_18-03-46jpg

Last edited by NullPtr; 09-15-2019 at 05:52 AM..
This User Gave Thanks to NullPtr For This Post:
# 4  
Old 09-15-2019
This first thing I noticed was that your script starts off:

Code:
#!/bin/sh

but the title of your post has the words "Error in ksh script:"

Are you planning / hoping / wanting / needing to write a ksh or sh script?

Generally it makes a difference...... ksh and sh are not the same species of shell fish....
# 5  
Old 09-15-2019
Oh, sorry, I really do not really understand this, I just need to fix the error in this script to install some software. I think I'll learn how to work with shell scripting later, now i just don't have time for this

Last edited by NullPtr; 09-15-2019 at 10:18 AM..
# 6  
Old 09-15-2019
Quote:
Originally Posted by NullPtr
Oh, sorry, I really do not really understand this, I just need to fix the error in this script to install some software. I think I'll learn how to work with shell scripting later, now i just don't have time for this
That is one truly bizarre statement.

If you really don't understand shell scripting WHY attempt to do a so-called fix.
Neo has given you a starter so let me make it a little clearer change/edit the first line #!/bin/sh to #!/bin/ksh and see if that matches your requirement.
As for learning it later, if you haven't got time now you will never have the time in the future...

EDIT:
Also check line 40 the 'PATH's are correct and concatenated correctly...

Last edited by wisecracker; 09-15-2019 at 11:16 AM.. Reason: See EDIT.
# 7  
Old 09-15-2019
Yeah, i know, i'm already apologized for that trash post. It's actually not my script, but i'm really need that script fixed for software that i need for study. So u have no idea why does the error appear?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compilation error character is missing-UNIX shell script

Dear Friends, Regarding Compilation error character is missing-unix shell script I am new to unix shell script. My requirement is --I need to find out 3 files in my UBM unix directory,if any one(CMUSER) file is available means,then i need to exit from my unix script, Below is my unix... (2 Replies)
Discussion started by: Joseph2017
2 Replies

2. Red Hat

Missing period files in ksh

Hi Guys :) while trying to set the paths for Oracle, sqlplus etc. I have been trying to find dot files (.profile or .kshrc or .bashrc or .cshrc or .login or .bash_profile or similar files) to append new paths so that I can connect to oracle from a shell script (RedHat 6.3 with KSH shell). But I... (6 Replies)
Discussion started by: Pradeep Jangra
6 Replies

3. Shell Programming and Scripting

ksh, difference between double bracket and single bracket

Can somebody tell me the difference between double brackets and single brackets, when doing a test. I have always been acustomed to using single brackets and have not encountered any issues to date. Why would somebody use double brackets. Ie if ] vs if Thanks to... (2 Replies)
Discussion started by: BeefStu
2 Replies

4. Shell Programming and Scripting

Ksh Shell Script Error

Hi, While running below code i am getting error as below 0403-004 Specify a parameter with this command. Please look it below code and let me know about if condition. Code is As below #!/usr/bin/ksh Infa_Src_Dir=$DIR/SrcFiles/pp Load_Info_Lst_Path=$DIR/SrcFiles/pp... (1 Reply)
Discussion started by: samadhanpatil
1 Replies

5. Shell Programming and Scripting

Double bracket giving error

here is a small script I wrote: #! /bin/bash if ] then echo "argument is null" fi It is giving error: test.sh: any idea, why is it so? (2 Replies)
Discussion started by: vina201unx2011
2 Replies

6. Shell Programming and Scripting

Missing ] error in csh script

The below script gives error: Missing ] #!/bin/csh set MAX=15 set PATTERN='dtsession' set NUM=`ps -eaf | grep -c $PATTERN` echo "No of dtsession = "$NUM if then echo 'Quota exceeded permissible limit' echo 'sending mail...............' mail hiten.r.chauhan@gmail.com<<EOF ... (2 Replies)
Discussion started by: hiten.r.chauhan
2 Replies

7. Shell Programming and Scripting

Expect Script square bracket dollar prompt

Hi Thanks for this amazing forum first, I've been searching answers in it for problems that I've encountered at work. The only problem I haven't been able to find a fix for, is a ever waiting for prompt problem in Expect when encounter a $ prompt. I usually set the timeout to -1 cause the... (2 Replies)
Discussion started by: Ikaro0
2 Replies

8. Shell Programming and Scripting

Bash script error: missing destination file name operand.

Ok, i've been messing around in debian the past few days, setting up programs like subversion, mysql and logrotate. The purpose of this script is to use subversion to backup the binary logs. It runs in the cron every 2 hours or so (although I can't get my script to run properly atm, which is why... (1 Reply)
Discussion started by: cganly
1 Replies

9. Shell Programming and Scripting

ksh/awk help - output missing numbers

Here is what I am trying to do: I have a list of numbers that I pulled from an awk command in a column like so: 1 3 4 7 8 I want to find which numbers in the list are missing out of a range. So let's say I want to find out from the list above which numbers are missing from the... (6 Replies)
Discussion started by: afavis
6 Replies

10. Shell Programming and Scripting

error in ksh script

Hi, i am facing an error in the following script in the korn shell but in bash it is working , can any help me to convert the below script to korn shell script without errors. echo 123.4566 | bc -l | awk -F '.' '{ print $1; exit; }' Thanks in advance kamal (5 Replies)
Discussion started by: G.K.K
5 Replies
Login or Register to Ask a Question