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

zsh: permission denied: help #3833

Closed
zenis0102 opened this issue Feb 9, 2019 · 6 comments
Closed

zsh: permission denied: help #3833

zenis0102 opened this issue Feb 9, 2019 · 6 comments
Labels

Comments

@zenis0102
Copy link

zenis0102 commented Feb 9, 2019

I have installed Ubuntu-18.04 as for WSL on a x64 based Windows 10 and typing all following commands in bash gives me zsh: permission denied: help

  1. help
    zsh: permission denied: help
  2. help export
    zsh: permission denied: help
  3. help sed
    zsh: permission denied: help

I'm new to Linux system and just trying to get some help info about export command as I found out that it is a builtins command so there is no man page for it in my system.

I'll appreciate any help.

@craigloewen-msft
Copy link
Member

craigloewen-msft commented Feb 12, 2019

Hi @zenis0102 ,

If you want some help info for different commands I would recommend typing in the commands like this:
sed --help

Edit: As @therealkenc noted below, export is a shell command and so this command will not always work as expected for every shell. However it does show some help information for bash shell. Thank you @therealkenc ! :)
export --help

And if you'd like to view some more detailed pages you can always view the manual pages of some applications with
man sed

Does that help answer your question?

@therealkenc
Copy link
Collaborator

trying to get some help info about export command

I would recommend typing in the commands like this commands like
export --help

export is a shell builtin (ie, there is no /usr/bin/export). Thus there is no man page, and no export --help on zsh. The relevant page of the zsh manual is here.

The permission denied error made me curious though. An EACCES doesn't make sense. The expected error is: zsh: command not found: help, because unlike bash, zsh doesn't have a help builtin. Turns out:

532   execve("/mnt/c/WINDOWS/system32/config/systemprofile/.dnx/bin/help", ["help"], 0x7fffdecc3c40 /* 21 vars */) = -1 EACCES (Permission denied)
532   access("/mnt/c/WINDOWS/system32/config/systemprofile/.dnx/bin", X_OK) = -1 EACCES (Permission denied)

Which has the fun repro:

$ ls -l /mnt/c/WINDOWS/system32/config/systemprofile/.dnx/bin/help
ls: cannot access '/mnt/c/WINDOWS/system32/config/systemprofile/.dnx/bin/help': Permission denied

Which is probably dupe #2779, though that's as far as the motivational curiosity took me.

@zenis0102
Copy link
Author

zenis0102 commented Feb 12, 2019

thank you both @mscraigloewen and @therealkenc for any recommendation.

First of all, I'm sorry that I made a small but misleading mistake here:

typing all following commands in bash

actually I have edited .bashrc file to start zsh for WSL shell and I typed all those commands in zsh shell and NOT the bash although I thought it was obvious from the shell-outputs in my post.


as to

I would recommend typing in the commands like this

export --help

which @therealkenc clarified it too there is no export --help command in zsh. Following outputs may explain it more clearly.

here is the result in zsh :

$ export --help
export: bad option: -e

and I don't know where the option: -e has come from!
and in fish :

$ export --help
/usr/share/fish/functions/export.fish (line 9): $- is not a valid variable in fish.
                set -gx $v $$v
                            ^
in function 'export'
        called on standard input
        with parameter list '--help'

and finally for the good old bash :

$ export --help
export: export [-fn] [name[=value] ...] or export -p
    Set export attribute for shell variables.

    Marks each NAME for automatic export to the environment of subsequently
    executed commands.  If VALUE is supplied, assign VALUE before exporting.

    Options:
      -f        refer to shell functions
      -n        remove the export property from each NAME
      -p        display a list of all exported variables and functions

    An argument of `--' disables further option processing.

    Exit Status:
    Returns success unless an invalid option is given or NAME is invalid.

or

$ help export
export: export [-fn] [name[=value] ...] or export -p
    Set export attribute for shell variables.

    Marks each NAME for automatic export to the environment of subsequently
    executed commands.  If VALUE is supplied, assign VALUE before exporting.

    Options:
      -f        refer to shell functions
      -n        remove the export property from each NAME
      -p        display a list of all exported variables and functions

    An argument of `--' disables further option processing.

    Exit Status:
    Returns success unless an invalid option is given or NAME is invalid.

and either of two latter ones were the very info I was expecting for export --help or help export for which I had to reset .bashrc not to load zsh shell but the bash itself. Now I understand that neither zsh nor fish shell has the export command and I can ONLY use it inside the bash shell because export is a builtin command of the bash and for the help command, zsh does not have it again where fish has it but loads its documentation or man file even for help export.

thanks again for the good replies.


[EDIT]

zsh does have an export command as therealkenc stated at his reply below:

Export is a builtin in zsh just like bash. Per the link I sent previously. It is the builtin documented after exit and before false.

@therealkenc
Copy link
Collaborator

Now I understand that neither zsh nor fish shell has the export command and I can ONLY use it inside the bash shell because export is a builtin command of the bash

Export is a builtin in zsh just like bash. Per the link I sent previously. It is the builtin documented after exit and before false.

$ export --help
export: bad option: -e

You passed argument --h to zsh's export builtin which takes no e option.

Contrast "export PATH=$PATH:/home/ken/mybinaries" which will behave as expected in zsh/fish/dash, same as bash.

[But not csh or tcsh which uses the builtin setenv because Bill Joy.]

@zenis0102
Copy link
Author

Export is a builtin in zsh just like bash. Per the link I sent previously. It is the builtin documented after exit and before false.

I just overlooked that part of zsh documentation, sorry about that and a big thank you @therealkenc for correcting my mistake and providing really helpful and extensive info. I will edit my previous comment to add the correct information.

@cerealXDD
Copy link

cerealXDD commented May 15, 2022

This is not working. help history on zsh does not work. Works on bash though.

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

4 participants