Show HN: Try my new Bash prompt PS1='\$ ' # short and sweet prompt old_cmdno=${old_cmdno-0} old_lines=${old_lines-0} old_cols=${old_cols-0} prepare_terminal() { stty rows $((LINES - 1)) printf "\n\033[1A" old_lines=$LINES old_cols=$COLUMNS } update_status_line() { local exit=$? local getcmdno='\#' local cmdno=${getcmdno@P} local esc=$(printf "\033") local pwd=$PWD local dots= [ $LINES -eq $old_lines -a $COLUMNS -eq $old_cols ] || prepare_terminal local status_esc="$esc[7m$esc[m" while true; do [ "${pwd#/*/}" == "$pwd" ] && break local status="$esc[7m$(date +%m-%d/%H:%M)$esc[m $HOSTNAME $dots$pwd" local status_len=$((${#status} - ${#status_esc})) [ $status_len -le $COLUMNS ] && break pwd=${pwd#/} pwd=/${pwd#*/} dots='...' done status_len=$((${#status} - ${#status_esc})) [ $status_len -gt $COLUMNS ] && status= printf "${esc}7$esc[%s;1H$esc[K%s$esc[1;%sr${esc}8" $((LINES + 1)) "$status" $LINES if [ $exit -ne 0 -a $cmdno -ne $old_cmdno ] ; then printf "!%s!\n" $exit fi old_cmdno=$cmdno } PROMPT_COMMAND='update_status_line' August 4, 2023 at 08:50AM
Show HN: Try my new Bash prompt https://ift.tt/1LVzxvF
Related Articles
Show HN: New Beautiful Desktop and Web UI/Monitoring for Apache KafkaKinesis https://ift.tt/Cd4nhtFShow HN: New Beautiful Desktop and Web UI/Monitoring for Apache Kafka+… Read More
Show HN: Wolfia Codex Ask anything about any code https://ift.tt/dEIz6H9Show HN: Wolfia Codex – Ask anything about any code Hi HN, we’re excit… Read More
Show HN: Winded View Multiple Tailwind Breakpoints Simultaneously https://ift.tt/FckN5T7Show HN: Winded – View Multiple Tailwind Breakpoints Simultaneously He… Read More
Show HN: Automize I hate writing web tests so I wrote a Chrome extension https://ift.tt/oWFqS4UShow HN: Automize – I hate writing web tests so I wrote a Chrome exten… Read More
Show HN: Open-source shooter which made it to AC: Valhalla and Skydio drones https://ift.tt/miK3EWtShow HN: Open-source shooter which made it to AC: Valhalla and Skydio … Read More
Show HN: WinGPT AI Assistant for Windows 3.1 https://ift.tt/oEgS4nKShow HN: WinGPT, AI Assistant for Windows 3.1 Hey HN, I didn't want my… Read More
Show HN: Fossfox paid opportunities for open-source devs https://ift.tt/PwMjV8iShow HN: Fossfox – paid opportunities for open-source devs The index l… Read More
Show HN: ChatHN Chat with Hacker News using natural language https://ift.tt/koszWaTShow HN: ChatHN – Chat with Hacker News using natural language Hi agai… Read More
0 Comments: