[Assorted-commits] SF.net SVN: assorted:[1536] shell-tools/trunk/src/bash-commons/common.bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-12-31 00:57:10
|
Revision: 1536 http://assorted.svn.sourceforge.net/assorted/?rev=1536&view=rev Author: yangzhang Date: 2009-12-31 00:57:00 +0000 (Thu, 31 Dec 2009) Log Message: ----------- added pdfsplit, capitalize; renamed colors Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2009-12-30 18:31:32 UTC (rev 1535) +++ shell-tools/trunk/src/bash-commons/common.bash 2009-12-31 00:57:00 UTC (rev 1536) @@ -23,15 +23,30 @@ # \e = \E = \033 # 0;34m = 34m # 30's are foregrounds, 40's are backgrounds +# Escape sequences begin with \e[ and end with m. +# Each is a sequence of commands, separated by ;. +# 0 and 1 set the lightness, but 0 also resets everything (fg/bg). +# 3x sets the foreground. +# 4x sets the background. -dark_blue="\e[0;34m"; bright_blue="\e[1;34m" -dark_green="\e[0;32m"; bright_green="\e[1;32m" -dark_cyan="\e[0;36m"; bright_cyan="\e[1;36m" -dark_red="\e[0;31m"; bright_red="\e[1;31m" -dark_magenta="\e[0;35m"; bright_magenta="\e[1;35m" -brown="\e[0;33m"; yellow="\e[1;33m" -black="\e[0;30m"; dark_gray="\e[1;30m"; -bold_white="\e[1;37m" white="\e[0;37m" +fg_dark_blue="\e[0;34m"; fg_bright_blue="\e[1;34m" +fg_dark_green="\e[0;32m"; fg_bright_green="\e[1;32m" +fg_dark_cyan="\e[0;36m"; fg_bright_cyan="\e[1;36m" +fg_dark_red="\e[0;31m"; fg_bright_red="\e[1;31m" +fg_dark_magenta="\e[0;35m"; fg_bright_magenta="\e[1;35m" +fg_brown="\e[0;33m"; fg_yellow="\e[1;33m" +fg_black="\e[0;30m"; fg_dark_gray="\e[1;30m" +fg_white="\e[0;37m"; fg_bold_white="\e[1;37m" + +bg_dark_blue="\e[0;44m"; bg_bright_blue="\e[1;44m" +bg_dark_green="\e[0;42m"; bg_bright_green="\e[1;42m" +bg_dark_cyan="\e[0;46m"; bg_bright_cyan="\e[1;46m" +bg_dark_red="\e[0;41m"; bg_bright_red="\e[1;41m" +bg_dark_magenta="\e[0;45m"; bg_bright_magenta="\e[1;45m" +bg_brown="\e[0;43m"; bg_yellow="\e[1;43m" +bg_black="\e[0;40m"; bg_dark_gray="\e[1;40m" +bg_white="\e[0;47m"; bg_bold_white="\e[1;47m" + normal_color="\e[0m" # Don't use 'error' to print the message because error might be a special @@ -559,6 +574,19 @@ done } +pdfsplit() { + local f="$@" + for i in $( seq $( pdfpages "$f" ) ) + do pdftk "$f" cat $i output "${f%.pdf}-$i.pdf" + done +} + +# capitalize the first letter of the given arg +capitalize() { + echo -n "${1:0:1}" | tr '[:lower:]' '[:upper:]' + echo "${1:1}" +} + # Add keys if not already added. maybe-ssh-add() { if ( ssh-add -l && ! ssh-add -l | fgrep $1 ) >& /dev/null This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |