I have my own scripts folder somewhere in home. It's in PATH.

In bash, when I start writing and hit TAB, the scripts get completed nicely.

But when I start with . (source), completion with TAB doesn't work.

Is it possible to get completion after . too? Thanks

  • . reads from a file, not from a command. If you want tab completion, you'll get it when you try to supply a valid argument, like /home/myuser/myscript.sh, not just myscript.sh unless ~ is your current working directory. – zondo Apr 13 '17 at 0:03
  • 1
    Woah. I was just posting an answer quoting the help ., but then I noticed this: The entries in $PATH are used to find the directory containing FILENAME. I then did a test with . pydoc. It had a syntax error, but it was indeed trying to source the file. My answer, despite the sense it makes, is wrong :/ It's true that giving it a file path will get you tab completion, but now I'm not sure why it won't give you tab completion from PATH. – zondo Apr 13 '17 at 0:20
  • by "completion" are you asking only about TAB filename completion, or having the scripts be found in $PATH? – Jeff Schaller Apr 13 '17 at 1:21
  • @JeffSchaller I have a script setEnv.sh in /home/me/work/scripts. If I am in /home/me, and I have /home/me/work/scripts in PATH, I'd like to type . setE<TAB> which would expand to . setEnv.sh . Hope this makes it clear. – fablife Apr 13 '17 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.