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.
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.
#!/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...
This first thing I noticed was that your script starts off:
#!/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....
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...
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?
Looks like /tmp/nx_inst/nx100/ug_inst
aborts and dumps core, when it is called as "$1"
in line 40. Does it run correctly on its own?
Your error report says that, AT, line 40, there is something wrong with:
PATH=/tmp/bin:$PATH "$1"
Not knowing ANYTHING about the installer nor its aborted error 9666 then we have to guess.
is $1 an absolute PATH or is it an absolute PATH containing an executable from inside line 6:
/tmp/SIEMENS/nx100/ug_install
IF EITHER how does the said absolute PATH get created.