[CentOS] bash file direct execution

dan1 dan1 at edenpics.com
Tue Aug 2 01:13:02 UTC 2005


>> This script is the following:
>>
>> #!bin/sh
>> CURRENT_IP=`/sbin/ifconfig eth0 | grep inet | cut -d : -f 2 | cut -d 
>>   -f
>> 1`
>> export CURRENT_IP
>> echo $CURRENT_IP
>>
>
>You need to change the first line to #!/bin/sh
>
>Otherwise, the script is looking for a bin directory in whatever current
>directory you are in. Unless you are at the root of the filesystem, it most
>likely won't be found.
>
>Matt


Hello, Matt.

Sorry for that. Yes you are right it is a mistake. However this was only on 
this script. The problem I described before still remains the same for the 
other scripts and even on this one once I have corrected it to #!/bin/sh.

There is simply no output at all for those scripts and no error message 
neither. And it's also strange that it works when put in the /root directory 
and not in the /. The /root is on the same filesystem than / and I have 
verified in the /etc/fstab : the / is mounted with the options: 
defaults,usrquota,grquota. The 'noexec' option is not set.

Any other idea ?

Thanks,
Daniel






More information about the CentOS mailing list