Using Environment Variable With Angular

Developing an application can be done with just localhost URLs, but when it comes to building and deploying software, we need to change these URLs to appropriate values.

While working with Angular, it might be painful to replace all these values without making any mistakes or complex configurations. Some guides say it can be done by configuring “Webpack,” but I find them quite confusing. Here is a workaround solution that will work for all bundlers and can also work with Docker builds.

The Differences Between Bash, Source, “.”, and “./” Execution

While working on Linux, you probably run across some files that are not executing in the way you expected — for example, you might have a file in your current directory but it does not run when you enter its name. You get file_name.sh command not found, but actually, the file is there. The file does not work, even having execution permission, because when you write something on the shell and run it, your $PATH variable gets checked. If there is any command matching inside $PATH directories, such as /usr/bin, it will execute. Unless there is a matching command, you are going to get the error.

So you need to address the path to your file. Let’s create a simple Linux shell script and have execution permission on the script. The below examples are written in Bash Shell.