FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 06-30-2010, 09:47 PM
Victor Lowther
 
Default a little creative parameter expansion simplifies stat_die()

---
functions | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/functions b/functions
index 9b348b7..0acdbbf 100644
--- a/functions
+++ b/functions
@@ -57,7 +57,7 @@ if [[ $USECOLOR = YES || $USECOLOR = yes ]]; then
C_CLEAR="33[1;0m"
fi

-if [ -t 1 ]; then
+if [[ -t 1 ]]; then
SAVE_POSITION="33[s"
RESTORE_POSITION="33[u"
DEL_TEXT="33[$(($STAT_COL+4))G"
@@ -116,10 +116,8 @@ stat_fail() {
}

stat_die() {
- retval=1
- [ "$1" = "" ] || retval=$1
stat_fail
- exit $retval
+ exit ${1:-1}
}

status() {
--
1.7.1
 

Thread Tools




All times are GMT. The time now is 11:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org