LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   scripting woes (https://www.linuxquestions.org/questions/linux-newbie-8/scripting-woes-344717/)

Pestossimo 07-19-2005 02:02 PM

scripting woes - invoking scripts
 
Here's the background. I have a full install of Slackware 10 on one partition, and am using it to build a Linux From Scratch system on another partition. I'm using the how-to from the Linux Documentation Project.

I'm trying to compile bash, and am having trouble getting the configure script to run. Here's what I get when I try to run configure:

/mnt/lfs/usr/src/bash-3.0$ ./configure
-bash: ./configure: /bin/sh: bad interpreter: permission denied

Here's why I'm so befuddled:

* configure is flagged as an executable
* the script starts with #!/bin/sh
* /bin/sh is a symlink to /bin/bash
* all the permissions are correct for sh, bash and configure

I've written my own little test scripts and run them from the same directory without any problem. I can get configure to run by using 'source' or '.' but get other errors, which I will tackle later.

Why do some scripts seem to insist that I use 'source' or '.', and others run just fine?

darkleaf 07-19-2005 02:34 PM

Are the permissions right? Try "chmod +x configure"

Pestossimo 07-19-2005 05:48 PM

Okay, I checked, and it's not the permissions. Maybe this will help


Script started on Tue 19 Jul 2005 05:11:01 PM UTC

lfs@darkstar:/mnt/lfs/usr/src/bash-3.0$ configure
bash: ./configure: /bin/sh: bad interpreter: Permission denied
lfs@darkstar:/mnt/lfs/usr/src/bash-3.0$ ls -l configure
-rwxr-xr-x 1 lfs users 687082 2005-07-19 10:39 configure
lfs@darkstar:/mnt/lfs/usr/src/bash-3.0$ . configure

checking build system type...
i686-pc-linux-gnu
checking host system type...
i686-pc-linux-gnu
checking for emacs...
emacs
checking where .elc files should go...
${datadir}/emacs/site-lisp

Beginning configuration for bash-3.0-release for i686-pc-linux-gnu
checking for gcc...
gcc -s
checking for C compiler default output...
a.out
checking whether the C compiler works...
bash: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

Script done on Tue 19 Jul 2005 05:12:07 PM UTC


At this point, because I am using 'source' it logs me out when the script exits

Pestossimo 07-20-2005 12:43 PM

I figured it out. The problem was that the script was sitting on another partition that I had mounted.

The how-to that I've been following said that I should compile everything as an unprivileged user. To do this I set the user option for that partition in /etc/fstab so I wouldn't have to su root to mount that partition. What I didn't realize was that the user option also sets the noexec option. So, even though the permissions for each file and directory were correct, I couldn't execute anything on that partition, be it a script or a compiled program.


All times are GMT -5. The time now is 09:59 PM.