PDA

View Full Version : odd bash behaviour in fc9



Camberwell
19th August 2008, 03:08 AM
good evening,

I have a little question, i'm actualy asking about a friends fc9

the bash wont execute certain .sh files without putting sh ./whatever.sh

example.....


[mossup@mossup-linux ut]$ ./ut
bash: ./ut: Permission denied

[mossup@mossup-linux ut]$ sh ./ut
Couldn't run Unreal Tournament (ut-bin). Is UT_DATA_PATH set?

[mossup@mossup-linux ut]$


ignor the fact that it doesn't run, i just wonder why it doesn't accept just ./ut
the file is set be executable

just as a test i made my own little script .....


#!/bin/bash

MARTIN="Hello World"
echo $MARTIN


which runs with ....



[mossup@mossup-linux poof]$ ./dunc.sh
Hello World
[mossup@mossup-linux poof]$


so scripts run, just not that ut one, and the ut2004 script does the same thing.

does anyone have any ideas as to why this might be???

thanks in advance

Camberwell

Hlingler
19th August 2008, 03:15 AM
It's telling you why:
Couldn't run Unreal Tournament (ut-bin). Is UT_DATA_PATH set?Apparently, it's not finding the game data, or it needs to be told explicitly where to look. So tell it:
[mossup@mossup-linux ut]$ UT_DATA_PATH=<insert-PATH-to-UT-data-files> sh ./utV

EDIT: Maybe I missed your question: if you really want to know: "Why doesn't it execute ./ut", I think it may be because it doesn't have the '.sh' file extension???

Camberwell
19th August 2008, 03:19 AM
the UT_DATA_PATH is set as it goes, but thats not the issue really

surely just typing ./ut at the prompt should give me the same response

why do i have type sh ./ut ????

thanks

EDIT:sorry just tried to rename the file to ut.sh and it still says permission denied

Hlingler
19th August 2008, 03:22 AM
Again, I could be wrong (in which case someone will be sure to point that out :) ), but I believe that it has to have the '.sh', '.bin', or '.run' file extension.

V

Camberwell
19th August 2008, 03:27 AM
also with the file renamed as ut.sh

at the prompt if i just type ut[TAB] to auto complete it wont even do that

yet sh ./ut[TAB] will auto complete it to sh ./ut.sh

its quite odd

wintersm
19th August 2008, 04:02 AM
maybe ut or ut.sh are not properly set as executable or misses other important things,

first do a ls -l ut*

and see if you have x under the permissions for the user, otherwise do a simple chmod a+x ut*

then see if you can ./ut to execute it, otherwise you will have to do a "sh ut" which you are telling the program sh, that its parameter is ut in the current directory so it will attempt to run that without cheking permissions..

as far as i know bash will not execute anything on the command line unless

its on a directory in the path list
or you specify the full path (ie /bin/somecommand or ./somecommand for current directory)
AND its set as executable (see chmod).

scripts usually have something like
#!/bin/bash

or

#!/bin/perl

in the first line to tell bash what interpreter to use when running the script.

thats my thought on the matter, some of it could be wrong..

JohnVV
19th August 2008, 04:09 AM
well as to needing to add the ./ first .
That is because the folder that ut in in IS NOT in the system path
edit the file ~/.bash_profile , it is in your home directory
and add

PATH=$PATH:/( path to the file):$HOME
UT_DATA_PATH=/( the path to the data )
export PATH UT_DATA_PATH

then edit ( if you can it ,might be a normal shell script ) ut
and make sure that this is on the very,very first line


#! /bin/bash

Camberwell
19th August 2008, 04:18 AM
Thanks for the replies guys

the file is definatly set to be executable...



[mossup@mossup-linux ut]$ ls -l ut*
-rwxr-xr-x 1 mossup mossup 1759 2008-08-19 02:21 ut
[mossup@mossup-linux ut]$ ./ut
bash: ./ut: Permission denied
[mossup@mossup-linux ut]$ sh ./ut
Couldn't run Unreal Tournament (ut-bin). Is UT_DATA_PATH set?
[mossup@mossup-linux ut]$


i just dont get it :confused: :confused:

like i say, ignor the fact that it fails to start, its the ./ut permission denied that is my issue

EDIT: also the ut script has got #!/bin/bash at the start and i have allready added the UT_DATA_PATH to my .bash_profile



[mossup@mossup-linux ut]$ echo $UT_DATA_PATH
/home/mossup/Documents/Storage/Games/ut/System
[mossup@mossup-linux ut]$


if some has a reason why the game wont run then by all means i'd like to know that too :)

Hlingler
19th August 2008, 04:22 AM
Baffling. Please post results:
head -n 25 ut

V

Camberwell
19th August 2008, 04:26 AM
here goes ....



[mossup@mossup-linux ut]$ head -n 25 ut
#!/bin/sh
#
# Unreal Tournament startup script
#

# The user preferences directory
UT_PREFS="${HOME}/.loki/ut"


# Function to find the real directory a program resides in.
# Feb. 17, 2000 - Sam Lantinga, Loki Entertainment Software
FindPath()
{
fullpath="`echo $1 | grep /`"
if [ "$fullpath" = "" ]; then
oIFS="$IFS"
IFS=:
for path in $PATH
do if [ -x "$path/$1" ]; then
if [ "$path" = "" ]; then
path="."
fi
fullpath="$path/$1"
break
fi
[mossup@mossup-linux ut]$

Hlingler
19th August 2008, 04:36 AM
:confused:

<shrug>

V

marcrblevins
19th August 2008, 05:41 AM
Chamberwell, please attach that whole file?

Also try this:


ll .loki/ut

Does it really exists?

brebs
19th August 2008, 06:37 AM
The partition is probably mounted with noexec.

man mount

Camberwell
19th August 2008, 06:49 PM
The partition is probably mounted with noexec.

man mount

WooHoooo

thanks for that, the partition was indeed mounted with noexe, even tho in the fstab it is mounted with defaults and exec is a default, but anyway now i have exec in there specificaly and all runs sweet :)

thankyou very much for all your suggestions

happy now

Camberwell