I’ve just set autocd
in my .bash_profile
:
shopt -s autocd
Now I can just type
$ some-directory
and automatically cd
into it. Now, can I somehow tell Bash that if I enter not just a directory name, but a filename:
$ some-directory/file.txt
that I want it to open that file in an editor (e.g. Vim)? I don’t know that this would be a built-in option, but I’d hope that I could do it using clever scripting.
file.txt
has execute permission? :)bash: some-directory/file.txt: No such file or directory