In Unix, I create a lot of aliases/functions. Here is my workflow:
- I have a file name 'aliases.txt' in my $HOME directory
- I have a quick command to edit that file
I have an alias named 'sa' that sources that alias file. I.e.
'alias sa='. $HOME/aliases.txt'
I can quickly and easily create, modify, and use new aliases.
I'm trying to re-create the same work flow in PowerShell but it doesn't work. I've got the aliases.ps1 file in my $HOME directory. I tried creating an 'sa' alias, but of course a PowerShell alias can't contain an argument. So I've tried:
function sa {. $HOME\aliases.ps1 }
I can run it but changes in my aliases.pl1 file don't get reflected in my shell session. I'm assuming it's because Windows runs the 'sa' function in a new process, which Unix runs functions and aliases in the same process. How can I get my 'sa' back?
("Type '. $HOME\aliases.ps1' at the command line each time" is not the answer I'm looking for.