I want other developers to have some convenient methods. Therefore I want to give them a script, that automatically sets an alias.
E.g the command grunt compileModule:[modulename]
should set the alias cprev
to be this exact command. The command should still be executed after setting the alias!
As we are commonly working multiple days on the same module, the alias should also get an entry in the ~/.bashrc
file (this is the main 'feature', so whenever they close the bash, they dont need to put in the whole command on reentering)
Now there are many posts about history
and how to look up which commands where run last, etc., but I could not find out how to sort of 'concatenate' all the information to result in what I need.
I was thinking creating an alias for grunt
.
Something like
alias grunt='~/myScriptForAliasHistory.sh;grunt $1';
would that be suitable?
Edit
to make this more clear:
The original command is
grunt compileModule:[name]
and it should be working like this after the modification.
It should only do an additional step, so you can call the same function as
cprev
as well (with the same parameters)
The workflow could look like this:
- Developer starts working on a new module. In order to compile it, he writes
grunt compileModule:[name]
. - The same developer needs to restart his bash/pc/console. Now he does not want to write the whole command again, but wants to only type
cprev
(which then executesgrunt compileModule:[name]
) - The next day he starts working on module
[anothername]
, so he executesgrunt compileModule:[anothername]
- If he now restarts, the command
cprev
will executegrunt compileModule:[anothername]
In other words:
Whenever grunt compileModule
is called, it should overwrite the alias cprev
with its own current call parameters.
$1
) with an alias. You'd have to generate a function instead.