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

"/bin/sh: nil: No such file or directory" #254

Closed
bdmorin opened this issue Jun 14, 2017 · 9 comments
Closed

"/bin/sh: nil: No such file or directory" #254

bdmorin opened this issue Jun 14, 2017 · 9 comments
Assignees
Labels

Comments

@bdmorin
Copy link

bdmorin commented Jun 14, 2017

For the life of me I can't figure out where this is coming from.

/bin/sh: nil: No such file or directory
New SSH connection to xxx@xxxx:222
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-106-generic x86_64)

For the life of me I cannot figure out where this /bin/sh: nil is being generated from. It's not causing any problems, and it doesn't show up when I run it in debug/verbose. Is anyone else seeing this?

*edited typo

@moul
Copy link
Owner

moul commented Jun 24, 2017

Hi @bdmorin,

Is there a typo in your comment? I can see /bin/sh in the example and /bin/ssh in the description, which one is the right one?

Can you give me the full command that fails so I can try to reproduce?

Thank you for your feedback!

@moul moul self-assigned this Jun 24, 2017
@moul moul added the Bug label Jun 24, 2017
@bdmorin
Copy link
Author

bdmorin commented Jun 24, 2017

The snippet is correct, I'm sorry. I fat fingered the error when I was typing it in.

-> % ssh bmorin@prodapp4
/bin/sh: nil: No such file or directory
New SSH connection to bdmorin@prodapp4:22
...

I only run assh on my desktop/laptop, but my dotfiles are pretty much the same. I'll try a fresh install on a new profile.

@bdmorin
Copy link
Author

bdmorin commented Jun 24, 2017

Looks like I found the issue:

        # Log internal information to a file
            - 'exec echo {{.}} | jq . >> ~/.ssh/last_connected_host.txt'

I commented out this line and that message went away. I have jq installed. I'll see if I can't figure out what's going on.

@moul
Copy link
Owner

moul commented Jun 25, 2017

Hi @bdmorin, I just made some changes (#256) that should be helpful for you, can you give a new try?

@hbokh
Copy link

hbokh commented Jan 12, 2018

FYI still not working on assh version 2.7.0 (HEAD); macOS 10.13.2; /usr/local/bin/zsh / "oh-my-zsh".

@moul
Copy link
Owner

moul commented Jan 12, 2018

@hbokh can you give a new try ? :)

@hbokh
Copy link

hbokh commented Jan 12, 2018

Merci, but no luck...
I ran brew unlink assh and brew install assh --HEAD which gave me /usr/local/bin/assh -> ../Cellar/assh/HEAD-95a790a/bin/assh.
When using this version it still shows the same "nil"-message:

# ssh some_host
/bin/sh: nil: No such file or directory
New SSH connection to ...

when using the config

    OnConnect:
      # Log internal information to a file
      - 'exec echo {{.}} | jq . >> ~/.ssh/last_connected_host.txt'

Do you need any more information from my side?

@moul
Copy link
Owner

moul commented Jan 13, 2018

I reproduced your error and found a workaround:

# use 
      - exec echo {{.|json|b64enc}} | base64 -D | jq . > ~/.ssh/last_connected_host.txt
# instead of
      - 'exec echo {{.}} | jq . >> ~/.ssh/last_connected_host.txt'

The error here was about a shell syntax error, because {{.}} returns a golang representation of a complex object that contains quotes, double quotes, backslashes etc

I tried to use exec echo {{.|json}} | jq . > ~/.ssh/last_connected_host.txt, which returns a json representation of the object instead of the golang one, but it's the same issue, shell syntax error


I will try to find a way to validate the syntax to display more comprehensive errors

@hbokh
Copy link

hbokh commented Jan 14, 2018

Superbe! The error is now gone, but you'll have to use base64 -d (lower caps d) instead.

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

No branches or pull requests

3 participants