overview
To distinguish it from your usual environment, define aliases for the commands used in MacPorts.
procedure
- Creating an Alias File
- Check if it was created
- Importing an Alias File
- Check if the setting was successful
1. Creating an alias file
Create an alias file in your home folder and add the string you want to set to the alias file.
mkdir ~/bashrc_folder
touch ~/bashrc_folder/macports_alias
echo 'alias hello_macports_alias="echo hello_macports_alias"' >> ~/bashrc_folder/macports_alias
2. Check if it was created
Make sure that the bashrc_folder folder exists in your home folder and that the echoed string appears in the macports_alias file.
ls -l ~
cat ~/bashrc_folder/macports_alias
3. Importing an Alias File
Open a terminal and set up an alias with the following command
source ~/bashrc_folder/macports_alias
4. Check if the setting was successful
Run the hello_macports_alias command and if it displays hello_macports_alias, it’s OK.
hello_macports_alias
Points to note
Please note that the alias file will be cleared when you close the terminal, so you will need to reload the alias file the next time you open the terminal.