diff setup @ 246:4eeccee282b1

Much more portable. Tested on Solaris (bourne shell yay).
author Edho Arief <edho@myconan.net>
date Mon, 07 Nov 2011 12:34:33 +0700
parents 719b0687d974
children c6ad8279b076
line wrap: on
line diff
--- a/setup	Mon Nov 07 12:30:06 2011 +0700
+++ b/setup	Mon Nov 07 12:34:33 2011 +0700
@@ -19,7 +19,7 @@
   case "$1" in
     uninstall|install)
       _rc "${1}" "tcsh" ".ecos_tcsh"
-      _init "${1}" '[ -r "${HOME}/.ecos_tcsh" ] && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' ".cshrc"
+      _init "${1}" 'test -r "${HOME}/.ecos_tcsh" && source "${HOME}/.ecos_tcsh" #ECCORE_TCSH' ".cshrc"
     ;;
   esac
 }
@@ -76,7 +76,7 @@
   _scripttmp="${HOME}/.tmp.${3}"
   _data="${2}"
   if [ -f "${_script}" ]; then
-    grep -v "${_data}" "${_script}" > "${_scripttmp}"
+    grep -v "`printf "%s\n" "${_data}" | sed 's/.*#//'`" "${_script}" > "${_scripttmp}"
     mv -f "${_scripttmp}" "${_script}"
   fi
   case "${1}" in
@@ -111,3 +111,4 @@
     _help
   ;;
 esac
+