changeset 412:5bee5c55a7a0

args test + bash overrides hg safety
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 04 Aug 2013 22:59:52 -0700
parents 9d6e7a471fc7
children 337984b6af92
files .bash_overrides bin/example/args.sh
diffstat 2 files changed, 32 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.bash_overrides	Sun Aug 04 15:58:31 2013 -0700
+++ b/.bash_overrides	Sun Aug 04 22:59:52 2013 -0700
@@ -97,6 +97,21 @@
     `which find` -L "$DIR" -not -path '*.svn*' "$@"
 }
 
+function hg {
+    if [[ "$(hg root)" == "${HOME}" ]]
+    then
+        if [[ "$*" == st* ]]
+        then
+            command hg st -q
+            return
+        fi
+        if [[ "$*" == res* ]] || [[ "$*" == pu* ]]
+        then
+            echo "Aborting \'hg $*\'; hg root is ${HOME}!"
+        fi
+    fi
+}
+
 function lsdiff {
     # TODO: extract this general pattern as a bash "decorator"
     if expr "$1" : 'http[s]\?://.*' &> /dev/null
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/example/args.sh	Sun Aug 04 22:59:52 2013 -0700
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+function foo {
+ echo '$*'="$*"
+ echo '$@'="$@"
+ echo '$#'="$#"
+ if [[ "$*" == "test string" ]]
+ then
+     echo '$*' == "test string"
+     if [[ "$@" == "test string" ]]
+     then
+         echo '$@' == "test string"
+     else
+         echo '$@' != "test string"
+     fi
+ fi
+}
\ No newline at end of file