-
Notifications
You must be signed in to change notification settings - Fork 0
/
.profile
112 lines (100 loc) · 4.58 KB
/
.profile
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# -*- mode: sh -*-
#### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# File: $HOME/.profile
# Dummy .profile for BASH backward compatability. This file
# if invoked will call ~/.bash_common (which takes its place)...
# Created: 2019-005-16
# Modified: 2010-002-02
# Author: Alisha Awen - [email protected]
# Git Username: harmonicalchemy
# Ref: https://www.gnu.org/software/bash/
# Repo: Github.com:harmonicalchemy/pDotfiles.git
# Environment: Linux, BSD, (Qubes 4.0 App VMs) and Mac OS
# (not for hosted VPS or bare metal servers)
#
# Note1: If you have a legacy .profile file in your $HOME directory,
# BASH will source it if it does not find any such .bash_profile in
# there! ".profile" comes from the "wicked-old-days" I remember ;-)
# It's still around only because BASH includes it for backward
# compatibility and that has preserved it due in part on the laziness
# of sysAdmins and partly due to distro maintainers accommodating those
# lazy system Administrators to keep them happy and contented.
# Backwards compatability on a production machine serves no productive
# purpose! The objective is to sail your merchant ship as fast as she
# can go... And avoid all those pirates! Arrrrrr!!!
#
# Note2: Zsh also sources .profile $ZDOTDIR is not set, $HOME is used instead.
#
# Change Log: (descending chronological order)
#
# 2020-002-002 - Alisha Awen - [email protected]
# Updated this file to copy it for using within my public
# .DOTFILES repo... Security DueDiligence up to Q1 2020 now...
# This file is not actually used unless you loose your .bash_profile
# But I included it anyway... I was using it to troubleshoot my shell...
#
# 2019-005-16 - Alisha Awen Sheppard - [email protected]
# This file is brand new... I cloned it from my existing .bash_profile.
# Just like .bash_profile this simply calls my own: ~/.bash_common...
#### ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##
# First Check If INTERACTIVE:
# If
# Shell IS INTERACTIVE: Evaluate $HOME/.bashrc AND exit! We are done here.
# ELSE
# Only Evaluate $HOME/.bash_common...
# That's all folks...
#
# NOTE:
# For NON-INTERACTIVE Shells we need to load our custom ~/.bash_common
# init file, which sets environment variables for both BASH & Bourne...
# For INTERACTIVE Shells SH evaluates this file but NOT ~/.bashrc of course!
# Therefore for that case, we need to load ~/.bashrc from this file,
# AND NOT load our custom ~/.bash-common file because ~/.bashrc
# loads that file for us....
if [[ $- == *i* ]]; then
#### ~~~~~~~~~~~~~~~~~~~~
## BEGIN: .profile Evaluation - Entering File
# NOTE: The DEBUG Statements won't work for NON-INTERACTIVE of course.
# TODO: Change NON-INTERACTIVE Debug statements to write to log file instead...
# DEBUG Print Statements: (Export SH_DBG in your shell session to enable)
if [ "$SH_DBG" = true ] ; then
echo "BOURNE SH LOGIN - Entered & Evaluating: \$DOTFILES/.profile"
fi
#### ~~~~~~~~~~~~~~~~~~~~
#### ~~~~~~~~~~~~~~~~~~~~
## BEGIN: BOURNE Shell Interactive...
# DEBUG Print Statements: (Export SH_DBG in your shell session to enable)
if [ "$SH_DBG" = true ] ; then
echo "BOURNE SH LOGIN INTERACTIVE - \$DOTFILES/.profile - Preparing to Evaluate: .bashrc"
fi
#### ~~~~~~~~~~~~~~~~~~~~
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
else
#### ~~~~~~~~~~~~~~~~~~~~
## BEGIN: BOURNE Shell NON Interactive...
# DEBUG Print Statements: (Export SH_DBG in your shell session to enable)
# if [ "$SH_DBG" = true ] ; then
# echo "BOURNE SH LOGIN NON-INTERACTIVE - \$DOTFILES/.profile - Preparing to Evaluate: .bash_common"
# fi
#### ~~~~~~~~~~~~~~~~~~~~
##
# Evaluate $HOME/.bash_common:
# Common environment elements needed by interactive,
# non-interactive, & login shell sessions alike...
if [ -f ~/.bash_common ]; then
. ~/.bash_common
fi
fi
## This is all for now... I may have to add more to this for Ubuntu VPS droplets.
if [[ $- == *i* ]]; then
#### ~~~~~~~~~~~~~~~~~~~~
## END: $HOME/.profile - Leaving File...
# DEBUG Print Statements: (Export SH_DBG in your shell session to enable)
if [ "$SH_DBG" = true ] ; then
echo "END: \$DOTFILES/.profile - Leaving File..."
fi
fi
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~