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

Error when sourcing #34

Closed
slmjkdbtl opened this issue Jan 9, 2016 · 10 comments
Closed

Error when sourcing #34

slmjkdbtl opened this issue Jan 9, 2016 · 10 comments

Comments

@slmjkdbtl
Copy link

Error Message

/usr/local/bin/shml:360: = not found

Line 358 - 365

# Usage / Examples
##
if [ "$0" == "$BASH_SOURCE" ]; then

if [[ $@ =~ .*-v.* ]]; then
  echo "shml version ${SHML_VERSION}"
  exit 0
fi
@jdorfman
Copy link
Member

@voyga weird. How did you install shml?

@jmervine
Copy link
Member

@voyga (cc @jdorfman) Though testing, I'm seeing that the == method of testing strings doesn't work in zsh, and may not support other shells aside from bash. Can you provide some information by running the following commands and pasting your output to assist me in confirming...

First, shell information:

$SHELL --version

Second, test the line in question alone:

if [ "foo" == "foo" ]; then echo "pass"; else echo "fail"; fi

Lastly, help me test a fix by running:

if [ "foo" = "foo" ]; then echo "pass"; else echo "fail"; fi

All that said, I'm not sure we want to support shells other then bash, but I'm willing to make a few quick fixes and see if we can get it working in zsh.

@jmervine
Copy link
Member

Upon further inspection (it only took a minute), we're not going to support shells outside of bash at this time.

Ensure that you're running your script though bash by including #!/usr/bin/env bash or #!/bin/bash as the first line of the file, or by running it like so bash ./your_script.sh.

I'll leave this open for now, awaiting the requested information to ensure that my assumption is correct. Cheers!

@jdorfman
Copy link
Member

Thanks @jmervine

@slmjkdbtl
Copy link
Author

Solved, Thanks. @jmervine

@jmervine
Copy link
Member

@voyga Mind clarifying what the issue was you were having in case someone else runs in to the same issue and comes across this thread in a search?

Thanks!
J

PS - Closing

@simoniz0r
Copy link

I know this is super old, but when trying to source this in zsh I just had to remove the second = in line 360, and it works fine.

if [ "$0" = "$BASH_SOURCE" ]; then

@jdorfman
Copy link
Member

@simoniz0r thanks for the report. @jmervine I think it is time for a release. Maybe fix this and release #32

LMK and I will start the docs.

@jmervine
Copy link
Member

Revisiting based on @simoniz0r 's comment.

@jmervine jmervine reopened this Apr 16, 2018
jmervine added a commit that referenced this issue Apr 16, 2018
- Addressing zsh source issue per
#34 (comment). Thanks
@simoniz0r for the tip.
- Adding some basic checks to ensure that it sources correctly.
@jmervine
Copy link
Member

jmervine commented Apr 16, 2018

Addressed on the following commit -- cd551bf. Will be released with #32.

Thanks @simoniz0r for the tip.

cc @slmjkdbtl @jdorfman

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

4 participants