Thursday, August 3, 2023
Show HN: Try my new Bash prompt https://ift.tt/oxt4DFH
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
Subscribe to:
Post Comments (Atom)
Show HN: GPU market is absurd! So I built a dashboard of pricing/restock trends https://ift.tt/foSUnW5
Show HN: GPU market is absurd! So I built a dashboard of pricing/restock trends Hey HN! This idea started with me not being able to buy a GP...
-
Show HN: High school robotics code/CAD/design binder release Hello HN! My name is Patrick, and I am a junior at my High School’s FRC robotic...
-
Show HN: D&D meets Siri – Interactive voice adventure Hey HN! I've been building tooling for voice-driven apps over the past few mon...
-
Show HN: I Made an AI Social Media Manager to Automate Content Creation Hey HN, I am a Solopreneur, and I love building apps to automate bor...
No comments:
Post a Comment