About some of the previous suggestions here - you can use open
command combined with a
flag to open a file with specific application:
open -a [appname] [filename]
but if [filename]
doesn't exist it displays an error the file doesn't exists
or something like that, and doesn't create the required file, as you have requested.
Write the following to your ~/.bashrc
file (if that file doesn't exists, you can create it by writing touch ~/.bashrc
inside the terminal):
open2()
{
touch $2
open -a $1 $2
}
And use it like this:
open2 [appname] [filename]
Note that appname
is an application in your installed application folder (/Applications
).
The command touch
creates you the required file (don't worry, if the file exists it won't remove / reset the current file, only redefine the modification time to the current time).