question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

echo $SHELL is wrong

See original GitHub issue

echo $SHELL returns /bin/zsh but that is obviously false; it has none of the features of ZSH.

echo $BASH_VERSION returns 3.2.57(1)-release which matches macOs’s /bin/bash version.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
oskaptcommented, Dec 10, 2020
* At the same time, it gathers your environment variables and aliases from whatever SHELL you have configured as your default (zsh, in your case).

It doesn’t seem to do a good job of this. I use fish, and every command I run in Kui has this before the output:

bash: alias: doh-client: not found
bash: alias: docker run --rm -it monachus/doh-tools client: not found
bash: alias: hey: not found
bash: alias: docker run --rm -it rcmorano/docker-hey: not found
bash: alias: k: not found
bash: alias: kubectl: not found
bash: alias: ka: not found
bash: alias: kubectl apply: not found
bash: alias: kak: not found
<snip>

My best guess is that this is because, while the fish aliases file follows a bash-like format, the output of the alias command does not:

➤ alias
alias doh-client 'docker run --rm -it monachus/doh-tools client'
alias hey 'docker run --rm -it rcmorano/docker-hey'
alias k kubectl
alias ka 'kubectl apply'

Would this be easy to fix with some regex magic before passing it off to Bash, or with error handling to dump aliases that don’t follow the correct format? Since everything is bounced to a new Bash shell, there doesn’t seem to be any way to avoid this or filter it out, and it makes Kui unusable for me.

UPDATE: I was able to get around it by converting all my aliases to functions by recreating them with alias -s and then deleting aliases.fish:

cat aliases.fish | sed -E 's/^alias //' | grep -vE '^$' | grep -Ev '#' | while read x; 
  set name (echo $x | awk -F= '{ print $1 }'); 
  echo $name; 
  set val (echo $x | awk -F= '{ print $2 }'); 
  if ! test -f ~/.config/fish/functions/$name.fish; 
    alias -s $name=$val; 
  end; 
end
0reactions
k8s-ci-robotcommented, Aug 21, 2021

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Read more comments on GitHub >

github_iconTop Results From Across the Web

echo $SHELL shows `/bin/bash` as the output even after ...
The SHELL environment variable is only set when you perform a full login, e.g. by logging out and logging in again, or by...
Read more >
echo $SHELL is wrong · Issue #5041 · kubernetes-sigs/kui
echo $SHELL returns /bin/zsh but that is obviously false; it has none of the features of ZSH. echo $BASH_VERSION returns 3.2.57(1)-release ...
Read more >
echo that outputs to stderr - bash - Stack Overflow
You could do this, which facilitates reading: >&2 echo "error". >&2 copies file descriptor #2 to file descriptor #1. Therefore, after this redirection...
Read more >
What is wrong with “echo $(stuff)” or “echo `stuff`”? - Super User
I added this to indicate shells compatible and/or derived from sh (e.g. not powershell). It's not about any single shell; it's about the...
Read more >
Wrong Shell for user and $SHELL value [duplicate] - Ask Ubuntu
The default shell of my user somehow changed to /bin/sh even though it's set in /etc/passwd to /bin/bash. I can't seem to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found