spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

how to make vagrant use bash and resolve `[[: not found`?


If the script only contains trivial bashisms, you can simply rewrite it to sh-compatible, and change the shebang to #!/bin/sh.

Change

if [[ -z $NODE_VERSION ]]; then

to

if [ -z "$NODE_VERSION" ]; then

(The double quotes should properly be used in the Bash version too.)

However, recognizing and fixing Bashisms in a large script is potentially a nontrivial endeavour.

If the script is specifically bash-only, you can create a wrapper for it, like

#!/bin/sh
exec env bash /path/to/real/script

which solves the problem at the cost of an ugly extra layer of wrapping. (The env is not strictly necessary here if you only used it to avoid having to put in the full path to bash, but there are probably situations where it has other useful effects, too.)


Categories : Bash

Related to : how to make vagrant use bash and resolve `[[: not found`?
Why should i use vagrant if i use virtualenv?
The difference between virtualenv and Vagrant is that virtualenv is only about separate Python installations whereas Vagrant is about the whole machine. virtualenv isolates the Python interpreter and the Python dependencies on one machine so you can install multiple Python projects alongside each other with their own dependencies. But for the rest of the machine the virtualenv doesn't do anythin

Categories : Python
Setting up development vagrant box for Rails
you need to install the bundle gem using the rbenv gem command: rbenv global 2.1.2 # ensure all shims for current ruby version are there rbenv rehash gem install bundler # rehash again to make sure you get the `bundler` command from `rbenv` rbenv rehash bundle install Hope this helps

Categories : Ruby On Rails
How to setup a MongoDB with Vagrant and Docker
In order for servers to communicate I guess you would need to configure port forwarding properly, so that routing server would be able to access shards, and vice versa. With Vagrant one can configure port forwarding, and in this case, I suppose also needs to be combined with ports being properly configured for Docker containers. Refer to Vagrant Networking Configuration page and Vagrant's Docker

Categories : Mongodb
Symfony 2 application on Vagrant + Docker
I haven't used vagrant with docker, but I have had a simliar issue just using vagrant and symfony. I had to configure the permissions for the logs and cache dirs in the vagrant file, so something like this (guest is Ubuntu 14.04): config.vm.synced_folder "symfony/app/cache", "/vagrant/symfony/app/cache", owner: "www-data", group: "vagrant", mount_options: ["dmode=775,fmode=664"] config.vm.synced

Categories : Symfony2
Vagrant Multiple Machines Inter-SSH Key Authentication
Figured it out. The problem I was having was that I was setting my own key, but Vagrant boxes come installed with these keys and can't connect if you set config.ssh.private_key_path to a custom key. Found the hint in the documentation here, which I think could warn the user that they won't be able to connect if they tried to override the key while using a public box : config.ssh.private_key_p

Categories : Ubuntu
Recently Add
How to test if a variable exists and has been initialized
Add stdin as another file to a tar archive
Sum of all rows of all columns - Bash
I'm having an error while "gem uninstall rails"
what should be the if condition for separating big files during copy process?
awk script to print in between result before the final result
Is it necessary to quote command substitutions during variable assignment in bash?
Spliting specific word out in sentence in BASH and AWK?
Choosing directories to output by timestamp named directories
sed remove first two characters if some string existed
what does this strange little yellow arrow below the command prompt mean?
Windows batches in Cygwin with spaces in path and arguments
Tree hiearchy in Bash
How to redirect the output of time command to a log file?
Change files format from '.less' to '.scss'
Interleave two wildcard commands
Multiple options for the same `case` result in `bash`
Bash - default size in printf
Shell Scripting: awk not printing local variables correctly
Files in docker container disappear
Argument grouping in bash scripts
Inquire in fortran 90
How to write a decimal for loop in bash
Copy and Delete
Sed and UTF-8 encoding
Removing part of a line? [bash]
How can i fix my functions in bash
Replace multline text with indentation using sed
How to disown bash process substitution
Are there conventions to writing a --help message?
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.