Add dotnet command to alias of bash
Dotnet commands
I am using sample application created by dotnet run
.
To run dotnet core application on Ubuntu with compilation:
dotnet run -p {pathToFolderWithProjectJson} -- {arguments}
To run compiled application:
dotnet {pathToCompiledDll} {arguments}
where pathToCompiledDll
is a path to dll (it is in /bin/Debug/netcoreapp1.1/
be default).
Bash commands
To add dotnet alias (shortcut) to bash set of commands:
nano ~/.bash_aliases
And you need to add the next line to this file (bash_aliases):
alias helloWorld="dotnet run -p ~/projects/helloWorld -- ~/Peter"
where
- ~/projects/helloWorld is path to the project;
- ~/Peter is an argument passed to the application;
Now you are able to run helloWorld
in bash terminal after restarting it. You should see Hello World.
Links: