Small, Sharp Software Tools by Brian P. Hogan

Small, Sharp Software Tools by Brian P. Hogan

Author:Brian P. Hogan
Language: eng
Format: epub
Tags: Pragmatic Bookshelf
Publisher: Pragmatic Bookshelf


Handling .bash_profile

As you learned earlier in this section, the .bashrc file isn’t read by macOS and might not be read on other systems. The best solution is to tell ~/.bash_profile to load ~/.bashrc if it exists. On Ubuntu, the .profile file already does this for you, but let’s walk through the process anyway so you understand how it works. In addition, the ~/.bash_profile will be used instead of ~/.profile if it exists.

Open ~/.bash_profile in your text editor:

​ ​$ ​​nano​​ ​​~/.bash_profile​

Add this code to the file which checks to see if the file ~/.bashrc exists and loads it if it does.

environment/bash_profile

​ ​if​ [ -f ~/.bashrc ]; ​then​

​ ​ ​source ~/.bashrc

​ ​fi​

Save the file and exit the editor. Now the settings will be applied no matter which way you start a new shell session.

Now let’s look at creating shortcuts to commands.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.