The need for command-line arguments is useful when defining an alias. But the result of verifying the document is that the alias does not support passing command-line arguments at all. However, we can work around this problem by defining the function.
The code is as follows |
Copy Code |
Alias test= ' Test () {echo $}; Test [hadoop@nn069186 dev]$ Source ~/.BASHRC [hadoop@nn069186 dev]$ test abc def GH ABC def [hadoop@nn069186 dev]$ |
The following example intercepts the alias defined by the self to facilitate the use of octopress to compose a Blog:
The code is as follows |
Copy Code |
Alias Pn= ' new () {bundle EXEC rake new_post["$"}; New
|
Here, I pass the parameter to alias PN by defining the new () function. Just do it now:
The code is as follows |
Copy Code |
PN ' Post title '
|
You can create a new post.
Another alias for submitting Source:
The code is as follows |
Copy Code |
Alias Pc= ' commit () {git Add.; Git commit-m "$"; Git push origin source}; Commit |