Bad interpreter? Bash? No way! - Mandriva
This is a discussion on Bad interpreter? Bash? No way! - Mandriva ; I have tried #!/bin/sh
and
#!/bin/bash under my profile and as root, but they both come up with
'Permission denied: bad interpreter'
How can a simple bash script, set executable and so forth, be
unexecutable (for want of a better ...
-
Bad interpreter? Bash? No way!
I have tried #!/bin/sh
and
#!/bin/bash under my profile and as root, but they both come up with
'Permission denied: bad interpreter'
How can a simple bash script, set executable and so forth, be
unexecutable (for want of a better term)? What has me puzzled is, it
was copied and pasted from a bash tutorial online, too.
Somebody help me before I decide to give up everything and live in a
cave...
-
Re: Bad interpreter? Bash? No way!
On Mon, 18 Jun 2007 12:57:10 -0700, shedied@gmail.com wrote:
> I have tried #!/bin/sh
> and
> #!/bin/bash under my profile and as root, but they both come up with
> 'Permission denied: bad interpreter'
Well, we need to see what you are doing with what.
I want you to do the following in your your user account. click up a terminal
and cut/paste the next 4 lines in your terminal and hit indicated control d
cat > kludge
#!/bin/bash
basename $SHELL
echo "it works"
^d <--------- that is a Ctl d to close the cat command.
Next, set execute perm with
chmod +x kludge
and run the script
../kludge
Still broke, cut from the cat > through your error message and paste
it as a reply.
-
Re: Bad interpreter? Bash? No way!
On Mon, 18 Jun 2007 15:57:10 -0400, wrote:
> I have tried #!/bin/sh
> and
> #!/bin/bash under my profile and as root, but they both come up with
> 'Permission denied: bad interpreter'
>
> How can a simple bash script, set executable and so forth, be
> unexecutable (for want of a better term)? What has me puzzled is, it
> was copied and pasted from a bash tutorial online, too.
Is the above in the first line of the file?
What do you get if you cd to the directory, and run "bash ./xxxxxx",
where xxxxxx is the name of the file, containing the script?
Regards, Dave Hodgins
--
Change nomail.afraid.org to ody.ca to reply by email.
(nomail.afraid.org has been set up specifically for
use in usenet. Feel free to use it yourself.)
-
Re: Bad interpreter? Bash? No way!
On Jun 18, 4:30 pm, "David W. Hodgins"
wrote:
> On Mon, 18 Jun 2007 15:57:10 -0400, wrote:
> > I have tried #!/bin/sh
> > and
> > #!/bin/bash under my profile and as root, but they both come up with
> > 'Permission denied: bad interpreter'
>
> > How can a simple bash script, set executable and so forth, be
> > unexecutable (for want of a better term)? What has me puzzled is, it
> > was copied and pasted from a bash tutorial online, too.
>
> Is the above in the first line of the file?
>
> What do you get if you cd to the directory, and run "bash ./xxxxxx",
> where xxxxxx is the name of the file, containing the script?
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8:en_US:en",
LC_ALL = (unset),
LC_PAPER = "en_US.UTF-8",
LC_ADDRESS = "en_US.UTF-8",
LC_MONETARY = "en_US.UTF-8",
LC_SOURCED = "1",
LC_NUMERIC = "en_US.UTF-8",
LC_TELEPHONE = "en_US.UTF-8",
LC_MESSAGES = "en_US.UTF-8",
LC_IDENTIFICATION = "en_US.UTF-8",
LC_COLLATE = "en_US.UTF-8",
LC_MEASUREMENT = "en_US.UTF-8",
LC_CTYPE = "en_AU.utf8",
LC_TIME = "en_US.UTF-8",
LC_NAME = "en_US.UTF-8",
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Am also going to try BT's suggestion.
-
Re: Bad interpreter? Bash? No way!
On Mon, 18 Jun 2007 13:51:57 -0700, shedied@gmail.com wrote:
> On Jun 18, 4:30 pm, "David W. Hodgins"
> wrote:
>>
>> What do you get if you cd to the directory, and run "bash ./xxxxxx",
>> where xxxxxx is the name of the file, containing the script?
> perl: warning: Setting locale failed.
>
> Am also going to try BT's suggestion.
Now it seems your "script" is a perl program not bash, and I'll guess
some kind of shell call/cmd created the original bash problem you indicated.
To solve your problem you will have to post the script. 
You may want to read http://www.catb.org/~esr/faqs/smart-questions.html
-
Re: Bad interpreter? Bash? No way!
On Jun 18, 4:27 pm, Bit Twister wrote:
> On Mon, 18 Jun 2007 12:57:10 -0700, shed...@gmail.com wrote:
> > I have tried #!/bin/sh
> > and
> > #!/bin/bash under my profile and as root, but they both come up with
> > 'Permission denied: bad interpreter'
>
> Well, we need to see what you are doing with what.
>
> I want you to do the following in your your user account. click up a terminal
> and cut/paste the next 4 lines in your terminal and hit indicated control d
> cat > kludge
> #!/bin/bash
> basename $SHELL
> echo "it works"
>
> ^d <--------- that is a Ctl d to close the cat command.
>
> Next, set execute perm with
> chmod +x kludge
>
> and run the script
> ./kludge
>
> Still broke, cut from the cat > through your error message and paste
> it as a reply.
Man it just returned an anticlimactic 'Permission denied'. THis has me
stumped. AFAIK, it was a straight install from the 586 (not 64bit)
portion of the DVD...
-
Re: Bad interpreter? Bash? No way!
On Mon, 18 Jun 2007 14:08:07 -0700, shedied@gmail.com wrote:
>> Still broke, cut from the cat > through your error message and paste
>> it as a reply.
Please read the above paragraph. We have to see everything you did.
> Man it just returned an anticlimactic 'Permission denied'. THis has me
> stumped. AFAIK, it was a straight install from the 586 (not 64bit)
> portion of the DVD...
Until you provide requested information, we cannot help you.
I also would like to see the output from
echo $PATH
ls -al /bin/bash
ls -al kludge
-
Re: Bad interpreter? Bash? No way!
On Jun 18, 5:16 pm, Bit Twister wrote:
> On Mon, 18 Jun 2007 14:08:07 -0700, shed...@gmail.com wrote:
> >> Still broke, cut from the cat > through your error message and paste
> >> it as a reply.
>
> Please read the above paragraph. We have to see everything you did.
>
> > Man it just returned an anticlimactic 'Permission denied'. THis has me
> > stumped. AFAIK, it was a straight install from the 586 (not 64bit)
> > portion of the DVD...
>
> Until you provide requested information, we cannot help you.
>
> I also would like to see the output from
>
> echo $PATH
> ls -al /bin/bash
> ls -al kludge
[jazze17@mondo ~]$ cat > kludge
#!/bin/bash
basename $SHELL
echo "it works"
[jazze17@mondo ~]$ chmod +x kludge
[jazze17@mondo ~]$ ./kludge
-bash: ./kludge: Permission denied
[jazze17@mondo ~]$ vi kludge
[jazze17@mondo ~]$ chmod +x kludge
[jazze17@mondo ~]$ ./kludge
-bash: ./kludge: /bin/bash: bad interpreter: Permission denied
[jazze17@mondo ~]$ more kludge
#!/bin/bash
basename $SHELL
echo "it works"
---(edited it to take out the extra space in front of the shebang, no
tthat I think it matters)
[jazze17@mondo ~]$ ls -al /bin/bash
-rwxr-xr-x 1 root root 725160 Aug 24 2006 /bin/bash*
[jazze17@mondo ~]$ ls -al kludge
-rwxrwxr-x 1 jazze17 jazze17 45 Jun 18 19:04 kludge*
[jazze17@mondo ~]$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games:/USR/local/bin:/
USR/bin:/USR/X11R6/bin:/usr/lib/qt3//bin:/home/jazze17/bin:/usr/games:/
USR/local/bin:/USR/bin:/USR/X11R6/bin:/usr/lib/qt3//bin:/home/jazze17/
bin
(USR is a partition on another hard drive containing extra programs
from an older Mandrake. I merely wanted to keep them and not reinstall
or recompile them all over again)
-
Re: Bad interpreter? Bash? No way!
shedied@gmail.com writes:
> I have tried #!/bin/sh
> and
> #!/bin/bash under my profile and as root, but they both come up with
> 'Permission denied: bad interpreter'
>
> How can a simple bash script, set executable and so forth, be
> unexecutable (for want of a better term)? What has me puzzled is, it
> was copied and pasted from a bash tutorial online, too.
>
> Somebody help me before I decide to give up everything and live in a
> cave...
Stop editing scripts on Windows and you will be fine.
Most likely you have DOS line endings on your file.
Run it thru dos2unix then try again.
-
Re: Bad interpreter? Bash? No way!
On Mon, 18 Jun 2007 16:10:15 -0700, shedied@gmail.com wrote:
> [jazze17@mondo ~]$ cat > kludge
> #!/bin/bash
> basename $SHELL
> echo "it works"
First two characters need to be #! if you want the /bin/bash to
execute. Not space #!. 
>
> [jazze17@mondo ~]$ chmod +x kludge
What is funny so far, your commands are working so show us what shell
you are running. command is
echo $SHELL
> [jazze17@mondo ~]$ ./kludge
> -bash: ./kludge: Permission denied
> [jazze17@mondo ~]$ vi kludge
> [jazze17@mondo ~]$ chmod +x kludge
Usually, Only one chmod needed.
>
> ---(edited it to take out the extra space in front of the shebang, no
> tthat I think it matters)
It does if you want /bin/bash to get control, otherwise it becomes a
comment instead of an instruction.
> [jazze17@mondo ~]$ ls -al /bin/bash
> -rwxr-xr-x 1 root root 725160 Aug 24 2006 /bin/bash*
Looking just like mine
> [jazze17@mondo ~]$ ls -al kludge
> -rwxrwxr-x 1 jazze17 jazze17 45 Jun 18 19:04 kludge*
Ok, execute perms for everyone and you are owner an group.
> [jazze17@mondo ~]$ echo $PATH
Looks within reason. I would like to see contents from
ls -al /usr/local/bin
Just for fun, do a
recode ibmpc..lat1 kludge
../kludge
-
Re: Bad interpreter? Bash? No way!
shedied@gmail.com wrote:
> [jazze17@mondo ~]$ cat > kludge
> #!/bin/bash
> basename $SHELL
> echo "it works"
Hmm... sumat's not right. It's too plain-sailing so far...
> [jazze17@mondo ~]$ chmod +x kludge
"cat kludge"
Note... no redirector. There is a difference.
> [jazze17@mondo ~]$ ./kludge
> -bash: ./kludge: Permission denied
Why?
"ls -al kludge"
--
Weblog - http://inbothworlds.wordpress.com/
R.L.U. #300033 - MDV 2006 - KDE 3.4
-
Re: Bad interpreter? Bash? No way!
shedied@gmail.com wrote:
> I have tried #!/bin/sh
> and
> #!/bin/bash under my profile and as root, but they both come up with
> 'Permission denied: bad interpreter'
>
> How can a simple bash script, set executable and so forth, be
> unexecutable (for want of a better term)? What has me puzzled is, it
> was copied and pasted from a bash tutorial online, too.
What sort of partition are you on? I got similar puzzling messages with
a script once, which stopped when I moved stuff off the FAT partition
onto an ext-3 one.
fp
-
Re: Bad interpreter? Bash? No way!
On Jun 19, 6:14 am, Frank Peelo wrote:
> shed...@gmail.com wrote:
> > I have tried #!/bin/sh
> > and
> > #!/bin/bash under my profile and as root, but they both come up with
> > 'Permission denied: bad interpreter'
>
> > How can a simple bash script, set executable and so forth, be
> > unexecutable (for want of a better term)? What has me puzzled is, it
> > was copied and pasted from a bash tutorial online, too.
>
> What sort of partition are you on? I got similar puzzling messages with
> a script once, which stopped when I moved stuff off the FAT partition
> onto an ext-3 one.
>
First I thought it was because I copied a script and pasted off a web
page. Fine, at least it seemd to have reached the Perl part. But the
samples I've been given here, short ones, return the same error. So I
rebooted to the old Mandrake10.1 and I typed the little script with
the line 'echo $SHELL' and it worked: I received a reply "bash"
followed by "it works". I boot back to Mandriva. As root, I copied the
script over to root's home and ran it and it worked. But copying it
over to jazze17's home and running in console mode (no X) gives me
Permission denied.
ext3 Linux partition, and the script was copied over from ext2 IIRC
-
Re: Bad interpreter? Bash? No way!
On Tue, 19 Jun 2007 06:18:22 -0700, shedied@gmail.com wrote:
> First I thought it was because I copied a script and pasted off a web
> page.
I have seen problems when cut/pasting once in a blue moon.
> But the
> samples I've been given here, short ones, return the same error. So I
> rebooted to the old Mandrake10.1 and I typed the little script with
> the line 'echo $SHELL' and it worked: I received a reply "bash"
> followed by "it works". I boot back to Mandriva. As root, I copied the
> script over to root's home and ran it and it worked. But copying it
> over to jazze17's home and running in console mode (no X) gives me
> Permission denied.
Well, that step may have changed perms or you lost access.
This problem should not be a X gui problem. So click up a jazze
terminal and show us the results of the following:
id
ls -al kludge
recode ibmpc..lat1 kludge
cat kludge
../kludge
-
Re: Bad interpreter? Bash? No way!
On Jun 19, 10:07 am, Bit Twister wrote:
> On Tue, 19 Jun 2007 06:18:22 -0700, shed...@gmail.com wrote:
> > First I thought it was because I copied a script and pasted off a web
> > page.
>
> I have seen problems when cut/pasting once in a blue moon.
>
> > But the
> > samples I've been given here, short ones, return the same error. So I
> > rebooted to the old Mandrake10.1 and I typed the little script with
> > the line 'echo $SHELL' and it worked: I received a reply "bash"
> > followed by "it works". I boot back to Mandriva. As root, I copied the
> > script over to root's home and ran it and it worked. But copying it
> > over to jazze17's home and running in console mode (no X) gives me
> > Permission denied.
>
> Well, that step may have changed perms or you lost access.
> This problem should not be a X gui problem. So click up a jazze
> terminal and show us the results of the following:
>
> id
> ls -al kludge
> recode ibmpc..lat1 kludge
> cat kludge
> ./kludge
[jazze17@mondo ~]$ id
uid=502(jazze17) gid=502(jazze17) groups=12(mail),81(audio),
502(jazze17)
[jazze17@mondo ~]$ ls -al kludge
-rwxrwxr-x 1 jazze17 users 44 Jun 19 12:19 kludge*
[jazze17@mondo ~]$ recode ibmpc..lat1 kludge
recode: kludge failed: Ambiguous output in step `CR-LF..data'
[jazze17@mondo ~]$ cat kludge
#!/bin/bash
basename $SHELL
echo "it works"
[jazze17@mondo ~]$ ./kludge
-bash: ./kludge: /bin/bash: bad interpreter: Permission denied
-
Re: Bad interpreter? Bash? No way!
On 2007-06-19, shedied@gmail.com wrote:
> [jazze17@mondo ~]$ id
> uid=502(jazze17) gid=502(jazze17) groups=12(mail),81(audio),
> 502(jazze17)
> [jazze17@mondo ~]$ ls -al kludge
> -rwxrwxr-x 1 jazze17 users 44 Jun 19 12:19 kludge*
> [jazze17@mondo ~]$ recode ibmpc..lat1 kludge
> recode: kludge failed: Ambiguous output in step `CR-LF..data'
> [jazze17@mondo ~]$ cat kludge
> #!/bin/bash
> basename $SHELL
> echo "it works"
> [jazze17@mondo ~]$ ./kludge
> -bash: ./kludge: /bin/bash: bad interpreter: Permission denied
What is the output of 'mount' on its own?
Also what happens if you do it as root?
Sorry if this has been asked already.
Lordy
>
-
Re: Bad interpreter? Bash? No way!
On Tue, 19 Jun 2007 09:22:04 -0700, shedied@gmail.com wrote:
> [jazze17@mondo ~]$ ls -al kludge
> -rwxrwxr-x 1 jazze17 users 44 Jun 19 12:19 kludge*
Uh, huh, you are not in the users group.
So let's fix the gid ownership.
As jazze17, in the terminal, show us what happens with the following:
su root
chown jazze17:jazze17 kludge
exit
ls -ald $PWD
chmod 755 kludge
echo $PWD/kludge
$PWD/kludge
> [jazze17@mondo ~]$ recode ibmpc..lat1 kludge
> recode: kludge failed: Ambiguous output in step `CR-LF..data'
Good, no windoze carriage returns, so that ain't it.
-
Re: Bad interpreter? Bash? No way!
On Jun 19, 2:14 pm, Bit Twister wrote:
> On Tue, 19 Jun 2007 09:22:04 -0700, shed...@gmail.com wrote:
> > [jazze17@mondo ~]$ ls -al kludge
> > -rwxrwxr-x 1 jazze17 users 44 Jun 19 12:19 kludge*
>
> Uh, huh, you are not in the users group.
> So let's fix the gid ownership.
>
> As jazze17, in the terminal, show us what happens with the following:
>
> su root
> chown jazze17:jazze17 kludge
> exit
>
> ls -ald $PWD
> chmod 755 kludge
> echo $PWD/kludge
> $PWD/kludge
>
> > [jazze17@mondo ~]$ recode ibmpc..lat1 kludge
> > recode: kludge failed: Ambiguous output in step `CR-LF..data'
>
> Good, no windoze carriage returns, so that ain't it.
[jazze17@mondo ~]$ su root
Password:
[root@mondo jazze17]# chown jazze17.jazze17 kludge
[root@mondo jazze17]# exit
exit
[jazze17@mondo ~]$ ls -ald $PWD
drwx------ 43 jazze17 users 4096 Jun 19 16:43 /home/jazze17/
[jazze17@mondo ~]$ chmod 755 kludge
[jazze17@mondo ~]$ echo $PWD/kludge
/home/jazze17/kludge
[jazze17@mondo ~]$ $PWD/kludge
-bash: /home/jazze17/kludge: /bin/bash: bad interpreter: Permission
denied
[jazze17@mondo ~]$
-
Re: Bad interpreter? Bash? No way!
shedied@gmail.com wrote:
> [jazze17@mondo ~]$ su root
> Password:
> [root@mondo jazze17]# chown jazze17.jazze17 kludge
> [root@mondo jazze17]# exit
> exit
> [jazze17@mondo ~]$ ls -ald $PWD
> drwx------ 43 jazze17 users 4096 Jun 19 16:43 /home/jazze17/
> [jazze17@mondo ~]$ chmod 755 kludge
> [jazze17@mondo ~]$ echo $PWD/kludge
> /home/jazze17/kludge
> [jazze17@mondo ~]$ $PWD/kludge
> -bash: /home/jazze17/kludge: /bin/bash: bad interpreter: Permission
> denied
> [jazze17@mondo ~]$
cd /home
ls -al
Also... "whereis bash" and "ls -al /bin/bash"
--
Weblog - http://inbothworlds.wordpress.com/
R.L.U. #300033 - MDV 2006 - KDE 3.4
-
Re: Bad interpreter? Bash? No way!
On Tue, 19 Jun 2007 14:13:33 -0700, shedied@gmail.com wrote:
> On Jun 19, 2:14 pm, Bit Twister wrote:
>> On Tue, 19 Jun 2007 09:22:04 -0700, shed...@gmail.com wrote:
>> > [jazze17@mondo ~]$ ls -al kludge
>> > -rwxrwxr-x 1 jazze17 users 44 Jun 19 12:19 kludge*
>>
>> Uh, huh, you are not in the users group.
>> So let's fix the gid ownership.
>>
>> As jazze17, in the terminal, show us what happens with the following:
>>
>> su root
>> chown jazze17:jazze17 kludge
>> exit
>>
>> ls -ald $PWD
>> chmod 755 kludge
>> echo $PWD/kludge
>> $PWD/kludge
>>
>> > [jazze17@mondo ~]$ recode ibmpc..lat1 kludge
>> > recode: kludge failed: Ambiguous output in step `CR-LF..data'
>>
>> Good, no windoze carriage returns, so that ain't it.
> [jazze17@mondo ~]$ su root
> Password:
> [root@mondo jazze17]# chown jazze17.jazze17 kludge
> [root@mondo jazze17]# exit
> exit
> [jazze17@mondo ~]$ ls -ald $PWD
> drwx------ 43 jazze17 users 4096 Jun 19 16:43 /home/jazze17/
OK, look at your home directory's group value. (users) 
Yet your id shows
$ id
uid=502(jazze17) gid=502(jazze17) groups=12(mail),81(audio),
and you are not in the /users/ group.
Looking at mine we see
$ ls -ald $PWD
drwx--x--x 36 bittwister bittwister 4096 Jun 19 16:29 /home/bittwister
If it were me I would, click up a terminal
su - root
chown -R jazze17:jazze17 /home/jazze17
exit
../kludge