bash
Reference manpage: man bash
The shell... always under your fingertip. More you master, easier you manage linux machines
Redirect out and err to file and output
strace -f program 2>&1 | tee -a ./stdeo
Helper script prototype
Linuxengineering Toolbox helper script
.bashrc goodies
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
# set PATH so it includes user's private python venv bin if it exists
if [ -d "$HOME/venv/bin" ] ; then
PATH="$HOME/venv/bin:$PATH"
fi
# set PATH so it includes user's private rust cargo bin if it exists
if [ -d "$HOME/.cargo/bin" ] ; then
PATH="$HOME/.cargo/bin:$PATH"
fi
# Look up commands from current working directory
PATH=$PATH:.
# Load environment variables (and other shell definitions) from .env
if [ -e "$HOME/.env" ]
then
source ${HOME}/.env
fi
Render config files with bare bash
# Note: Variables resolved
cat << EOF > /etc/samba/smb.conf
[global]
dns forwarder = $DC_DNS_FORWARDER
netbios name = DC1
realm = $DC_REALM
server role = active directory domain controller
workgroup = $DC_DOMAIN
idmap_ldb:use rfc2307 = yes
tls enabled = yes
[sysvol]
path = /var/lib/samba/sysvol
read only = No
[netlogon]
path = /var/lib/samba/sysvol/$DC_REALM/scripts
read only = No
EOF