Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have noticed that unless I add an .sh extension to my shell scripts, Zsh does not suggest them for autocompletion for execution despite having them in my PATH. I have the same problem if I cd into the directory and start typing the filename.

When I say for execution I mean typing the file directly on the prompt, i.e.:

$ my_shell_script

Are there any options in Zsh that control which file extensions are considered for this type of autocompletion?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Have your shell scripts start with the appropriate shebang (#!) and with the execution permission bits on. zsh will then recognize them as proper executable files.

(With some configurations, you might have to refresh zsh paths cache. Restarting it with exec zsh is one way to do it.)

share|improve this answer
2  
rehash is a Zsh builtin which does exactly that. –  Mischa Arefiev Feb 16 '12 at 9:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.