The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

Now where is Kickstart with all the scripted posts by hieraco2007-07-09 01:36:38
  They are automated .. by LilDragon2007-07-09 01:40:14
    and there they are automagicly by hieraco2007-07-09 01:41:10
      I su'd to greg and ran the cronjobs manually by Myke2007-07-09 01:41:57
        Uhg - what a PS1 by Myke2007-07-09 01:55:04
          My PS1... by Phoon 2007-07-09 02:03:26
#!/bin/bash

# A prompt that will push the current directory up a line when it gets too 
# long, giving more space for commands.  Also, the current directory gets 
# truncated when it goes over a certain length

function fixlong {
  # Calculate the width of the prompt
  local newPWD="$PWD"
  local let pwdsize=$(echo -n ${newPWD} | wc -c | tr -d " ")
  if [ "$COLUMNS" ]; then
    # try to keep the environment clean
    let Xpwdmax=${COLUMNS}-5
    local pwdmax=$Xpwdmax
    unset Xpwdmax
  else
    local pwdmax=75
  fi
  if [ "$pwdsize" -gt "$pwdmax" ]; then
    let cut=${pwdsize}-${pwdmax}
    local newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cut\}\)\(.*\)/\2/")"
    unset cut
  fi

  if [ -f ~/.iwantcolorprompt ]; then

    #
    # foreground colors:
    #
    #local BLACK='\[\033[30m\]'
    local RED='\[\033[31m\]'
    #local GREEN='\[\033[32m\]'
    local YELLOW='\[\033[33m\]'
    local BLUE='\[\033[34m\]'
    #local MAGENTA='\[\033[35m\]'
    local CYAN='\[\033[36m\]'
    local WHITE='\[\033[37m\]'

    #
    # background colors:
    #
    #local BGBLACK='\[\033[40m\]'
    #local BGRED='\[\033[41m\]'
    #local BGGREEN='\[\033[42m\]'
    #local BGYELLOW='\[\033[43m\]'
    #local BGBLUE='\[\033[44m\]'
    #local BGMAGENTA='\[\033[45m\]'
    #local BGCYAN='\[\033[46m\]'
    #local BGWHITE='\[\033[47m\]'

    #
    # attributes:
    #
    local BRIGHT='\[\033[01m\]'
    local NORMAL='\[\033[00m\]'
    #local REVERSE='\[\033[07m\]'
    #local BLINK='\[\033[05m\]'      # doesn't work in xterms
    #local UNDERSCORE='\[\033[04m\]' # only works in xterms

    # zzzzzz='\[\033[00m\]'  # last env var

    # Go into/out of line drawing mode
    local LINE='\[\016\]'
    local UNLINE='\[\017\]'

  fi

  # Add the current user@host:pwd to the xterm titlebar
  case $TERM in
    xterm*)
      local TITLEBAR='\[\033]0;(\u) \w\007\]'
      ;;
    *)
      local TITLEBAR=''
      ;;
  esac

  if [ "$EUID" = "0" ]; then
    local mycolor=$RED
  else
    local mycolor=$CYAN
  fi

  if [ "$COLUMNS" ]; then
    let Xpwdflip=$COLUMNS/2
    local pwdflip=$Xpwdflip
    unset Xpwdflip
  else
    local pwdflip=40
  fi
  if [ "$pwdsize" -gt "$pwdflip" ]; then
    PS1="$TITLEBAR\
$BRIGHT$BLUE[$YELLOW$newPWD$BLUE]$NORMAL\n\
$BRIGHT$BLUE[$mycolor\u$BLUE]$mycolor\\$""$NORMAL "
  else
    PS1="$TITLEBAR\
$BRIGHT$BLUE[$mycolor\u$BLUE]\
[$YELLOW\w$BLUE]$mycolor\\$""$NORMAL "
  fi
}

PROMPT_COMMAND=fixlong
[ Reply ]
            Mine's better: by Myke2007-07-09 02:05:57
              What is wrong with PS1="#" ? by Cokish2007-07-09 02:07:41
                running pwd is too latent by Myke2007-07-09 02:11:28
                But PS1 is so old by Spisefisken2007-07-09 04:06:33
                  I downloaded Tekken Dark Resurrection by Cokish2007-07-09 04:37:07

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)