Click to See Complete Forum and Search --> : Newbie Question


Loki3
07-15-2002, 12:30 AM
I was reading the Introduction to Bash Programing HOWTO and was trying out the hello world script and I got an error.


$./hello.sh
bash: bash.scripts/hello.sh: /bin/bash: bad interpreter: Permission denied
$cat hello.sh
#!/bin/bash
echo Hello World
$ whereis bash
bash: /bin/bash /usr/lib/bash /usr/share/man/man1/bash.1.gz
$ ls -la /bin/bash
-rwxr-xr-x 1 root root 541096 Apr 12 16:09 /bin/bash


I don't really know what's wrong. Logging in as root doesn't fix it either. I checked other know good scripts that I didn't write and they have '#!/bin/sh', but using that instead of '#!/bin/bash' dosen't help. I'm using Red Hat 7.3 and bash-2.05a-13. Any advice? Thanks.

_Loki

Xander Solis
07-15-2002, 12:47 AM
type this in the shell

$ bash filename.sh

that should run your script.

Master_Ho
07-15-2002, 12:59 AM
chmod 755 hello.sh

Loki3
07-15-2002, 01:07 AM
*ahem* it was the permissions, sorry guys for the waste of your time. Stupid newbies.

_Loki

chris65
07-15-2002, 03:17 AM
seems like i had the same problem when i first started bash scripting. reading this post got me thinking, is there a way to make it so that linux automatticly sets the premmissions for "only what you create". lets say i am the only one on my computer, no network and no dialin servers, it would be nice to make a script or dir, or anything and not have to worry about settings or premisions. ? think about it.

dchidelf
07-15-2002, 01:16 PM
You can use umask to alter the default permissions.

A file created with permissions 666, with umask 006 (or 007) would end up being 660...

This doesn't help much because umask will only remove permissions, and most files are created with 666 permissions, so you can't make them executable with umask.

But as far as creating webpages, etc. you can probably use umask to make life easier (umask 22 , files created would be 644)

Creating executable files by default is a security issues, so most programs that create files don't do it.