#!/bin/bash # Number of spaces to indent SPACES=110 SPACER="$(printf '%*s' "$SPACES" '')" # 1. Set prompt (PS1) for current session export PS1="${SPACER}\u@\h:\w\$ " # 2. Define indent() function for on-demand use indent() { "$@" | sed "s/^/${SPACER}/" } # 3. Setup output redirection using FIFO and trap FIFO="/tmp/ttyshift.$$" exec 3>&1 # Save original stdout # Clean up on exit cleanup() { exec 1>&3 rm -f "$FIFO" } trap cleanup EXIT # Create FIFO and hook stdout through sed mkfifo "$FIFO" sed "s/^/${SPACER}/" < "$FIFO" >&3 & exec 1> "$FIFO" echo echo "${SPACER}✅ TTY right shift active (in-memory only)" echo "${SPACER}Type 'exit' or press Ctrl+D to quit and restore normal output" echo # Launch interactive shell with shifted output bash --norc