Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work in any shell (bash, zsh, etc) #10

Closed
douglascamata opened this issue May 16, 2012 · 12 comments
Closed

Work in any shell (bash, zsh, etc) #10

douglascamata opened this issue May 16, 2012 · 12 comments

Comments

@douglascamata
Copy link

I think it'll work just chaging all /bin/bash references to /bin/sh. Or maybe parsing the user's login shell everytime something runs under the shell.

@turicas
Copy link
Owner

turicas commented May 22, 2012

The sbc script (and all the others) currently can't run in /bin/sh -- it use some things related to bash.
We need to change it before changing all hashbangs. I think the most of the changes are related to subshells (replace $(...) with ....

After replacing it we should only use shells that support -l (for login shell) and -c (for command execution) options and loading of $HOME/.profile on initialization (we are using it to add a new directory on $PATH).

UPDATE: maybe we don't need -c, only -l and $HOME/.profile (the shell that will execute sbc-startup can be any (/bin/sh for example)).

What are the most used shells?

  • bash (100% compatible -- we use it!)
  • dash (compatible with -l, -c and $HOME/.profile)
  • zsh (compatible with -c and $HOME/.profile but not with -l)
  • ksh (compatible with $HOME/.profile but not with -l and -c)
  • csh (seems to be compatible)
  • tcsh (seems to be compatible)
  • busybox (?)

Am I missing any...?

Note: sh on Ubuntu it is linked to dash.

@turicas
Copy link
Owner

turicas commented May 23, 2012

The shell being used on server should also support adding a directory to the path -- today we add a line overwriting var $PATH on $HOME/.profile (it works for bash but don't know if works for all other shells).

@douglascamata
Copy link
Author

I think all the shells support that. I'm only sure that zsh support it.

@turicas
Copy link
Owner

turicas commented May 23, 2012

dash, bash, ksh and zsh supports $HOME/.profile (for login shells). csh and tcsh don't support. I didn't found information about busybox. The only one that appears to support all we need is dash. Need to find a way to solve the problem about -l and -c on ksh and -l on zsh.

@douglascamata
Copy link
Author

What does -l do on zsh that you need? And what command use it?

@turicas
Copy link
Owner

turicas commented May 23, 2012

It starts a login shell. I think there is no problem passing -l to zsh command (it'll ignore it but will start a login shell apparently). Maybe the same occurs with ksh.

ksh uses exec option to execute commands, so the equivalence on ksh for bash's bash -c "some command" is ksh exec "some command". But thinking more deeply, maybe we don't need -c option (only -l), since the script sbc-startup can run on any shell (it can be /bin/sh) -- I need to do some tests.

@kurtkraut
Copy link
Contributor

This project will be useful for that matter: http://sourceforge.net/projects/checkbaskisms/

@douglascamata
Copy link
Author

@turicas do you know is this supports fish? I'm currently using (and loving) it.

@turicas
Copy link
Owner

turicas commented Aug 17, 2014

@douglascamata, sbc still needs bash to run, but now it will work even if you default local shell and your default remote shell are not bash. It just needs bash to interpret the commands, but you can call sbc from any shell (@kurtkurat and me tested on bash, dash and zsh). Can you please test the current develop branch?

Please see issue #20 if you want to track development related to do not depend on bash to execute sbc.

@kurtkraut
Copy link
Contributor

@douglascamata We are turning sbc more shell agnostic. We are proof testing it to dash but in occasional tests with csh, ksh and zsh everything went fine. Give it a try on fish and give us a feedback. If fish doesn't anything fancy, it is expected to work.

@kurtkraut
Copy link
Contributor

@douglascamata I tested fish on both ends (local and remote) as a default shell and we found a bug. This was fixed in commit 2b65c5d and now fish support is verified. Have a happy fishing!

@douglascamata
Copy link
Author

@turicas @kurtkraut thank you, guys! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants