7

I'm running TinyCore Linux and when I tried to install RVM (needed a portable linux distro for QA Automation) I keep getting an error sh: syntax error:unexpected redirection.

I am unsure why I am getting this error since the echo $SHELL command returns BASH.

Any ideas on how I could get this working or get more details on the issue?

2
  • Some more detail on what commands you ran, how far they got, etc. might be useful. – Karpie Sep 11 '11 at 7:29
  • @karpie Unfortunately, that is as far as it got once I typed in the command: bash < <(curl -s rvm.beginrescueend.com/install/rvm) – JustAl Sep 11 '11 at 8:08
4

Your Tiny Core Linux install probably has a bare-minimum shell installed. This is probably busybox. You can verify this by checking if /bin/sh is symlinked to something else:

ls -l /bin/sh
lrwxrwxrwx    1 root     root             7 Dec 15 20:52 /bin/sh -> busybox

Since Tiny Core Linux loads the bare-minimum OS into RAM, this is desirable. However, if you need a more fully-featured shell you may install it via the Application Browser (See the List of available applications here, the command-line version of the application browser is tce-ab). Tiny Core Linux currently has: bash and tcsh.

To install bash:

tce-load -wi bash.tcz

The default shell is still /bin/sh, however you can spawn a bash shell by running bash from within it.

To set the tcuser's default shell:

which bash | sudo tee -a /etc/shells > /dev/null
sudo sed -i "/$(cat /etc/sysconfig/tcuser)/ s#:[^:]\+\$#:$(which bash)#" /etc/passwd

You might want to also install the GNU coreutils if you're looking for more GNU standard utilities for use in bash scripts also:

tce-load -wi coreutils.tcz
1

It looks like one of the scripts is running under /bin/sh but uses extended features of bash, possibly <<< or <(. You presumably have ash as /bin/sh; that's legitimate (and ash is measurably faster and uses less memory than bash, which is why many distributions don't put bash as /bin/sh), but occasionally you run into scripts that rely on bash yet start with #!/bin/sh.

That you have $SHELL set to bash is irrelevant, each script is executed by the shell indicated on the first line (the shebang, here #!/bin/sh). I've had a quick look at the RVM scripts, and it looks like all the ones that rely on bash extensions correctly start with #!/usr/bin/env bash. Do you have a prior existing ~/.rvm? If so, try moving it out of the way.

You can get an execution trace for a shell script by running the shell with the -x option. So run bash -x ./rvm and see where the error occurs. If the error occurs in a script called indirectly from the main rvm script, try adding set -x in the other scripts as well (immediately below the #! line), to see an execution trace for them. This should help locate the offending script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.