Ana Sayfa / Linux / Bash Script / Bash Script Sourcing

Bash Script Sourcing

Sourcing a file

Sourcing a file is different from execution, in that all commands are evaluated within the context of the current
bash session – this means that any variables, function, or aliases defined will persist throughout your session.

Create the file you wish to source

export A="hello_world"
alias sayHi="echo Hi"
sayHello() {
 echo Hello

From your session, source the file

$ source

From hencefourth, you have all the resources of the sourced file available

$ echo $A

$ sayHi

$ sayHello

Note that the command . is synonymous to source, such that you can simply use

$ .

Sourcing a virtual environment

When developing several applications on one machine, it becomes useful to separate out dependencies into virtual

With the use of virtualenv, these environments are sourced into your shell so that when you run a command, it
comes from that virtual environment.

This is most commonly installed using pip.

pip install

Create a new environment

virtualenv --python=python3.5 my_env

Activate the environment

source my_env/bin/activate

Bunada Göz Atın

PHP Types

Type Comparison There are two types of comparison: loose comparison with == and strict comparison …

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir