1755678 Members
4191 Online
108837 Solutions
New Discussion юеВ

Need an explanation

 
SOLVED
Go to solution
Davor Bira?
Frequent Advisor

Need an explanation

I have enconture strange behavior on my server.
It is C3600 with HPUX 11.0.
There is file bla:
pwd
/
ll bla
-rwxrwxrwx 1 root sys 12 Apr 12 15:20 bla
more bla
reboot
root

When I try this command, server shutdowns:
bla = $(cat bla)

There is entry in /var/adm/shutdownlog like this:
15:34 Tue Apr 12, 2005. Reboot: (by root)

There is no core file or something in /var/adm/crash.
Any help?
7 REPLIES 7
RAC_1
Honored Contributor

Re: Need an explanation

What you do is expected behaviour from bla = $(cat bla)

What do you want??

Anil
There is no substitute to HARDWORK
Robert-Jan Goossens_1
Honored Contributor
Solution

Re: Need an explanation

Hi,

Why should there be a crash file?

you did a reboot

bla=$(cat bla)
bla=reboot
reboot

Robert-Jan
Doug Burton
Respected Contributor

Re: Need an explanation

Yep, you ran "bla" as root I'll bet and rebooted the box. Remove the file "bla".

You may want to look over other files on your server. Wide open perms on home made files could be trouble.
john korterman
Honored Contributor

Re: Need an explanation

Hi,
maybe you expected that this line should perform a variable assignment, only:
# bla = $(cat bla)
but because of the space after "bla" the shell considers "bla" a separate command to be executed - which it apparently is.

regards,
John K.
it would be nice if you always got a second chance
Stephen Keane
Honored Contributor

Re: Need an explanation

It's not generally a good thing to name variables the same as executables! Also the space before the '=' means that the shell interprets your command as

Run executable bla with arguments '=' and '$(cat bla)'

Geoff Wild
Honored Contributor

Re: Need an explanation

Your substitution is wrong...

$(cat bla) - should be:

BLA=`cat bla`

Then echo $BLA will be:

reboot
root

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Davor Bira?
Frequent Advisor

Re: Need an explanation

Thanks for fast respond, it was really helpfull.