translator
11,127
edits
m (Minor additions and improvements) Tags: Mobile web edit Mobile edit |
(Marked this version for translation) |
||
Line 62: | Line 62: | ||
Sometimes you may need to create an alias that accepts one or more arguments. That’s where bash functions come in handy. | Sometimes you may need to create an alias that accepts one or more arguments. That’s where bash functions come in handy. | ||
<!--T:2--> | |||
The syntax for creating a bash function is very easy. They can be declared in two different formats: | The syntax for creating a bash function is very easy. They can be declared in two different formats: | ||
{{File|file=~/.bashrc| | {{File|file=~/.bashrc| | ||
Line 88: | Line 89: | ||
Now instead of using mkdir to create a new directory and then cd to move into that directory , you can simply type: | Now instead of using mkdir to create a new directory and then cd to move into that directory , you can simply type: | ||
{{UserCmd|command=mkcd new_directory}} | {{UserCmd|command=mkcd new_directory}} | ||
==Keeping bash alias in a different file== | ==Keeping bash alias in a different file== <!--T:3--> | ||
Bash allows you to add local aliases in your ~/.bashrc file. To do this create a file called ~/.bash_aliases and add these contents in your ~/.bashrc file: | Bash allows you to add local aliases in your ~/.bashrc file. To do this create a file called ~/.bash_aliases and add these contents in your ~/.bashrc file: | ||
{{File|file=~/.bashrc| | {{File|file=~/.bashrc| |