-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_venv_activate.sh
More file actions
76 lines (70 loc) · 1.58 KB
/
python_venv_activate.sh
File metadata and controls
76 lines (70 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
get_date(){
echo $(date '+%Y-%m-%d %H:%M:%S')
}
prRed(){
echo -e "\033[91m$1..."
}
prGreen(){
echo -e "\033[92m$1..."
}
prYellow(){
echo -e "\033[93m$1..."
}
prBlue(){
echo -e "\033[94m$1..."
}
prPink(){
echo -e "\033[95m$1..."
}
prRed
echo "The script executed at:" $(get_date)
prGreen
echo "Script is to Activate/Deactivte Python Virtual environment..."
prYellow
echo "Checking pip verson..."
pip --version
prBlue
echo "Virtual Environment creation in progres..."
python3 -m venv project-git
python3 -m venv project-jira
prPink
echo "Activating Venv in this machine..."
source project-jira/bin/activate
prRed
echo "On the fly writing a script..."
cat << EOF > hello.py
print("This is called advance concept in Python function. We use input, return, output in Python Functions...")
print("This is called advance concept in Python Function. We use input, return, output")
def plus(num1, num2):
add = num1 + num2
return(add)
def minus(num1, num2):
sub = num1 - num2
return(sub)
def multipl(num1, num2):
mul = num1 * num2
return(mul)
print(f"The addition of two number is:", plus(5,10))
print(f"The substraction of two number is:", minus(5,10))
print(f"The multiplication of two number is:", multipl(5,10))
EOF
sleep 2
ls -lrt
prGreen
echo "Executing python script..."
ls -lrt
python3 hello.py
prYellow
echo "Jira package Is exist or not"
pip list | grep jira
prBlue
echo "Jira package installation in progress..."
pip install jira
prPink
echo "greping Jira package"
pip list | grep jira
prRed
echo "Deactivating Venv in this machine ********"
deactivate
exit