Comments (11)
I also get this on Debian testing. It seems the -e
argument to bash causes the shell to exit right away when an error occurs, which alternatively can be enabled using set -e
when bash is started.
The solution is to replace
#!/usr/bin/env bash -e
with
#!/usr/bin/env bash
set -e
from rbenv.
Do you have bash
on your machine?
from rbenv.
I also get this error, I have bash on my machine. Ubuntu 11.04.
The problem comes on line 8 of bin/rbenv, where it tries to cd
into a directory called rbenv
, which doesn't exist. I have no idea why it's trying to cd into a nonexistent dir.
Running bash under debug mode (with -x
) shows this:
mark@mt~/.rbenv/bin> bash -x -e rbenv
++ abs_dirname rbenv
+++ pwd
++ local cwd=/home/mark/.rbenv/bin
++ local path=rbenv
++ '[' -n rbenv ']'
++ cd rbenv
rbenv: line 8: cd: rbenv: Not a directory
[/snip/]
from rbenv.
I have the same problem.
#!/usr/bin/env bash -e
what's the -e option?. It seems linux's env doesn't support option in hashbang.
#!/usr/bin/env bash
# just use bash is fine.
#!/usr/bin/env ls -l
#=> /usr/bin/env: ls -l: No such file or directory
my platform is ArchLinux.
from rbenv.
the solution is to not cd
into a directory that doesn't exist
from rbenv.
@mhansen: I think @ndreas' fix is also important - on my machine (Debian Squeeze), this does not work:
~% cat > test.sh
#!/usr/bin/env bash -e
echo "hello world"
~% chmod +x test.sh
~% ./test.sh
/usr/bin/env: bash -e: No such file or directory
~%
whereas the proposed alternative does:
~% cat > test.sh
#!/usr/bin/env bash
set -e
echo "hello world"
~% chmod +x test.sh
~% ./test.sh
hello world
~%
from rbenv.
Sorry, you're quite right. That's very confusing!
env
is trying to run a file called bash -e
, which it can't find anywhere in the path, instead of looking for a file called bash
and passing -e
as an argument.
$ env --version
env (GNU coreutils) 8.5
from rbenv.
Arguments on the shebang line are a known portability issue (see http://en.wikipedia.org/wiki/Shebang_(Unix)#Portability). Get enough people using something and the portability issues come out to play. But ndreas's fix should do the trick.
@mhansen I don't think the issue is env
(its version or anything), but rather that different systems handle tokenizing the shebang line differently.
from rbenv.
from rbenv.
Thanks for the fix! It works fine now. Its odd that the error only occurs when the script is executed from the command line.
$ bash --version GNU bash, version 4.2.8(1)-release (i686-pc-linux-gnu) $ cat a #!/usr/bin/env bash -e echo hello $ ./a /usr/bin/env: bash -e: No such file or directory $ bash ./a hello $
from rbenv.
When I type
$ ./a
Its still bash doing the work there to interpret the script, right?
Oh hold the phone - thinking back to unix classes. Bash is doing a
fork() and linux is trying to interpret the executable.
Thanks for the note!
Don
On Fri, Aug 12, 2011 at 10:56 AM, grahamedgecombe
[email protected]
wrote:
@donpdonp, it's because, as mentioned earlier, when Linux parses the shebang line it doesn't split the arguments up, so it basically runs this:
/usr/bin/env "bash -e"
Reply to this email directly or view it on GitHub:
#20 (comment)
from rbenv.
Related Issues (20)
- Helpful install message HOT 3
- Ubuntu 22 - no ruby 3.1.2 HOT 2
- clearer feedback message needed after running rbenv init HOT 1
- Question: why rbenv recommends inserting initial command to `~/.zshrc` instead of `~/.zshenv` or `~/.zprofile` ? HOT 2
- rbenv 1.2.0 (from Homebrew) not installing versions to ~/.rbenv/versions on Mac OS Ventura HOT 2
- Error installing mini_racer: ERROR: Failed to build gem native extension HOT 2
- Windows with WSL2 manual git clone installation method, wrong line endings HOT 4
- `rbenv init` fails in parallel environment HOT 2
- rbenv-doctor script fails: `printc:3: bad substitution` HOT 2
- version `GLIBC_2.38' not found HOT 2
- `rbenv doctor` warns about multiple paths, one symlinks to the other HOT 1
- homebrew ruby: gem command not found
- Multiple instances of rbenv-install HOT 2
- `gem-rehash` inop for `bundle install`
- GOV UK
- rbenv breaks non-interactive shells when switching user and installing version
- Shim doesn't work for Ruby 3.3.0 HOT 5
- Error when use "gem" HOT 1
- readme installation guide missing step? HOT 1
- install ruby 3.2.0 rbenv/1.1.2/libexec/rbenv: No such file or directory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbenv.