Under macOS, in .profile
I want to create an alias myproj
for a path, say ~/Documents/mywork/project
, so that in Terminal I can use the command:
open myproj
I tried simply adding to .profile
the line...
alias myproj="~/Documents/mywork/project"
... but after restarting Terminal, when I then try open myproj
I get error: The file /Users/me/myproj does not exist.
What's wrong?
alias
doesn't work that way.Try
alias myproj="open ~/Documents/mywork/project"
You type
the parser processes the alias and changes it to
Addendum
Maybe an alias isn't really what you wanted anyway.
You could do it more like your original attempt with a variable.
Instead of
try just
Then to open it,
or, better,
If you want more functionality, consider a function instead, though for this it's probably not needed.