1823830 Members
3427 Online
109665 Solutions
New Discussion

Bad Number/Syntax Errors

 
Kevin_258
New Member

Bad Number/Syntax Errors

A startup script of mine is trying to execute the following command:
su - -c
However every single time the startup script executes I get the following error in the rc.log file:
^˜\p^^â\: Syntax error
or:
Ø\p^¢\: bad number

Now after the system is completely up and running I can execute the same script successfully.

If I take out the alter the command from:
su - -c to:
su -c
it works. Altered it back and deleted the user's .profile (so the (-) is executing nothing) and the same errors returned?

Now the difference between the two errors:
Syntax error and bad number depends on the shell I'm executing the script in. If /sbin/sh its a syntax error and if its the ksh its a bad number.

Any advi
12 REPLIES 12
RAC_1
Honored Contributor

Re: Bad Number/Syntax Errors

When you do su - "user_name" -c "command"

the .profile of the user gets executed. You have a problem with code in .profile, which gives error.

When you do su "user_name -c "command", the user's .profile is not executed.

Anil
There is no substitute to HARDWORK
Steven E. Protter
Exalted Contributor

Re: Bad Number/Syntax Errors

Suggestion: Check and possibly restore /etc/profile

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
john korterman
Honored Contributor

Re: Bad Number/Syntax Errors

Hi,

is the 's shell by any chance c-shell?

regards,
John K.
it would be nice if you always got a second chance
Kevin_258
New Member

Re: Bad Number/Syntax Errors

No - the users shell is either the ksh or sh not using csh.

Thanks anyway...
Prashant Zanwar_4
Respected Contributor

Re: Bad Number/Syntax Errors

you can try changing the scripts sequence number. Just try to change it to something to make it run at last. There might be something which the environment is looking for and which is not there at the time script is running while coming up. Just put it at last

S999<script> I believe this shall take away the problem..

What happens when you execute the script in /etc/init.d and not the su user_id -c <script>

just check and reply..

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
john korterman
Honored Contributor

Re: Bad Number/Syntax Errors

Hi,
rather irritating about the shell, as c-shell would have fitted in nicely, also because ksh normally indicates a line number for the syntax error.
However, "bad number" may come from an if-condition that tries to compare a numeric value to either a text string - or more often - to an unexpanded variable. Is there anything like that in the script?

regards,
John K
it would be nice if you always got a second chance
Kevin_258
New Member

Re: Bad Number/Syntax Errors

The oracle startup script is my last S999 script in my /sbin/rc3.d directory. Tried inserting a test startup script before it and put the following simple command in it:
/usr/bin/su - oracle -c "/usr/bin/ls -l /tmp > /tmp/ls.out" 2>&1



(Also tried different users!)

The syntax error or bad number depends on the shell I defined the user in.

Also this started to happen after the lastest June 2004 bundle for HP 11.11.

The su is actually successfully, however something afterwards in the shell environment is blowing up.
Prashant Zanwar_4
Respected Contributor

Re: Bad Number/Syntax Errors

What if if you try putting the same in Oracle startup script end...

And as long as the script name is different S999 shall not matter..

if oracle starup is

S999oracle

then new script can be

S999pxxx...I believe it shall get through the problem..or just make the syntax part of some other script whihch executes in last..

Hope it helps

Let me see if I can find anything more on this

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Prashant Zanwar_4
Respected Contributor

Re: Bad Number/Syntax Errors

One other thing is you shall try giving

nohup

in the beginning..try this

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
John Kittel
Trusted Contributor

Re: Bad Number/Syntax Errors

There is a tecnical knowledge base document describing something along these lines. I don't think I am alowed to post the url (?)...

If you have access, search for "ksh bad number".

But it says that PHCO_26783 or PHCO_27418
cause "bad number" error in oracle environment setup script called from .profile. Offending command is "ulimit 4194304". Should be changed to "ulimit unlimited".

- John
Prashant Zanwar_4
Respected Contributor

Re: Bad Number/Syntax Errors

also

su - userid -c '/path/to/script -options'

this is one hint to resolve it.

Thanks
Prashant
"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."
Kevin_258
New Member

Re: Bad Number/Syntax Errors

the following line has been added to my same oralce startupscript as well:
/usr/bin/su - oracle -c "/usr/bin/ls -l /tmp > /tmp/ls.out" 2>&1

The command runs only up to the su, everything else doesn't run, put the /etc/profile in verbose mode and everything runs correctly.

In response to above, the ksh bad number is a ulimit problem and the error would be "unlimited bad number".

These same startup scripts run successfully if I execute them after the startup.

Now these error messages seem to be related to the shell environment and not a .profile or /etc/profile problem.

Just wondering if anyone ran into this problem before? Very weird.....