#!/bin/bash # Check if ~/.local/bin directory exists, if not, create it if [ ! -d "$HOME/.local/bin" ]; then mkdir -p "$HOME/.local/bin" echo "Created ~/.local/bin directory" fi # Check if ~/.profile file exists, if not, create it and add ~/.local/bin to PATH if [ ! -f "$HOME/.profile" ]; then touch "$HOME/.profile" echo "Created ~/.profile file" echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.profile" echo "Added ~/.local/bin to PATH in ~/.profile" else # Check if ~/.profile already contains the PATH modification, if not, add it if ! grep -q -F 'export PATH="$HOME/.local/bin:$PATH"' "$HOME/.profile"; then echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.profile" echo "Added ~/.local/bin to PATH in ~/.profile" fi fi