tag 509279 + patch
thanks

diff -urpN bash-3.2.orig/examples/misc/aliasconv.bash 
bash-3.2/examples/misc/aliasconv.bash
--- bash-3.2.orig/examples/misc/aliasconv.bash  2005-07-09 07:52:53.000000000 
-0600
+++ bash-3.2/examples/misc/aliasconv.bash       2008-12-23 10:36:42.000000000 
-0700
@@ -7,11 +7,14 @@
 # Chet Ramey
 # c...@po.cwru.edu
 #
-trap 'rm -f /tmp/cb$$.?' 0 1 2 3 6 15
+
+tmpfile=`mktemp`
+
+trap 'rm -f $tmpfile' 0 1 2 3 6 15
 
 T=$'\t'
 
-cat << \EOF >/tmp/cb$$.1
+cat << \EOF >$tmpfile
 mkalias ()
 {
        case $2 in
@@ -28,12 +31,12 @@ mkalias ()
 EOF
 
 # the first thing we want to do is to protect single quotes in the alias,
-# since they whole thing is going to be surrounded by single quotes when
+# since the whole thing is going to be surrounded by single quotes when
 # passed to mkalias
 
-sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" 
>>/tmp/cb$$.1
+sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" 
>>$tmpfile
 
-$BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
+$BASH $tmpfile | sed -e 's/\$cwd/\$PWD/g' \
                     -e 's/\$term/\$TERM/g' \
                     -e 's/\$home/\$HOME/g' \
                     -e 's/\$user/\$USER/g' \
diff -urpN bash-3.2.orig/examples/misc/aliasconv.sh 
bash-3.2/examples/misc/aliasconv.sh
--- bash-3.2.orig/examples/misc/aliasconv.sh    2002-11-30 15:20:23.000000000 
-0700
+++ bash-3.2/examples/misc/aliasconv.sh 2008-12-23 10:36:37.000000000 -0700
@@ -7,11 +7,14 @@
 # Chet Ramey
 # c...@po.cwru.edu
 #
-trap 'rm -f /tmp/cb$$.?' 0 1 2 3 6 15
+
+tmpfile=`mktemp`
+
+trap 'rm -f $tmpfile' 0 1 2 3 6 15
 
 T='    '
 
-cat << \EOF >/tmp/cb$$.1
+cat << \EOF >$tmpfile
 mkalias ()
 {
        case $2 in
@@ -28,15 +31,15 @@ mkalias ()
 EOF
 
 # the first thing we want to do is to protect single quotes in the alias,
-# since they whole thing is going to be surrounded by single quotes when
+# since the whole thing is going to be surrounded by single quotes when
 # passed to mkalias
 
-sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" 
>>/tmp/cb$$.1
+sed -e "s:':\\'\\\'\\':" -e "s/^\([a-zA-Z0-9_-]*\)$T\(.*\)$/mkalias \1 '\2'/" 
>>$tmpfile
 
-sh /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
-                    -e 's/\$term/\$TERM/g' \
-                    -e 's/\$home/\$HOME/g' \
-                    -e 's/\$user/\$USER/g' \
-                    -e 's/\$prompt/\$PS1/g'
+sh $tmpfile | sed -e 's/\$cwd/\$PWD/g' \
+                 -e 's/\$term/\$TERM/g' \
+                 -e 's/\$home/\$HOME/g' \
+                 -e 's/\$user/\$USER/g' \
+                 -e 's/\$prompt/\$PS1/g'
 
 exit 0
diff -urpN bash-3.2.orig/examples/misc/cshtobash 
bash-3.2/examples/misc/cshtobash
--- bash-3.2.orig/examples/misc/cshtobash       2002-11-30 15:23:41.000000000 
-0700
+++ bash-3.2/examples/misc/cshtobash    2008-12-23 10:36:28.000000000 -0700
@@ -15,25 +15,32 @@
 # Chet Ramey
 # c...@po.cwru.edu
 #
-trap 'rm -f /tmp/cb$$.? cshout cshin' 0 1 2 3 6 15
+tmp=`mktemp`
+aliastmp=`mktemp`
+envtmp=`mktemp`
+vartmp=`mktemp`
+cshout=`mktemp`
+cshin=`mktemp`
+
+trap 'rm -f $tmp $aliastmp $envtmp $vartmp $cshout $cshin' 0 1 2 3 6 15
 
 T=$'\t'
 
 SOURCE="${1:+source $1}"
 
-cat << EOF >cshin
+cat << EOF >$cshin
 $SOURCE
-alias >! /tmp/cb$$.a
-setenv >! /tmp/cb$$.e
-set >! /tmp/cb$$.v
+alias >! $aliastmp
+setenv >! $envtmp
+set >! $vartmp
 EOF
 
 # give csh a minimal environment, similar to what login would provide
-/usr/bin/env - USER=$USER HOME=$HOME PATH=/usr/bin:/bin:/usr/ucb:. TERM=$TERM 
SHELL=$SHELL /bin/csh -i < ./cshin > cshout 2>&1
+/usr/bin/env - USER=$USER HOME=$HOME PATH=/usr/bin:/bin:/usr/ucb:. TERM=$TERM 
SHELL=$SHELL /bin/csh -i < $cshin > $cshout 2>&1
 
 # First convert aliases
 
-cat << \EOF >/tmp/cb$$.1
+cat << \EOF >$tmp
 mkalias ()
 {
        case $2 in
@@ -49,16 +56,16 @@ mkalias ()
 }
 EOF
 
-sed "s/^\([a-zA-Z0-9_]*\)$T\(.*\)$/mkalias \1 '\2'/" < /tmp/cb$$.a 
>>/tmp/cb$$.1
+sed "s/^\([a-zA-Z0-9_]*\)$T\(.*\)$/mkalias \1 '\2'/" < $aliastmp >>$tmp
 
 echo '# csh aliases'
 echo
 
-$BASH /tmp/cb$$.1 | sed -e 's/\$cwd/\$PWD/g' \
-                  -e 's/\$term/\$TERM/g' \
-                  -e 's/\$home/\$HOME/g' \
-                  -e 's/\$user/\$USER/g' \
-                  -e 's/\$prompt/\$PS1/g'
+$BASH $tmp | sed -e 's/\$cwd/\$PWD/g' \
+                -e 's/\$term/\$TERM/g' \
+                -e 's/\$home/\$HOME/g' \
+                -e 's/\$user/\$USER/g' \
+                -e 's/\$prompt/\$PS1/g'
 
 # Next, convert environment variables
 echo
@@ -70,7 +77,7 @@ sed -e '/^SHLVL/d' \
     -e '/^PWD/d' \
     -e "s/'/'"\\\\"''"/g \
     -e "s/^\([A-Za-z0-9_]*=\)/export \1'/" \
-    -e "s/$/'/" < /tmp/cb$$.e
+    -e "s/$/'/" < $envtmp
 
 # Finally, convert local variables
 echo
@@ -82,7 +89,7 @@ sed -e 's/'"$T"'/=/' \
     -e '/^[A-Za-z0-9_]*=[^(]/{
        s/=/='"'/"'
        s/$/'"'/"'
-       }' < /tmp/cb$$.v |
+       }' < $vartmp |
 sed -e '/^argv=/d' -e '/^cwd=/d' -e '/^filec=/d' -e '/^status=/d' \
         -e '/^verbose=/d' \
         -e '/^term=/d' \
@@ -110,7 +117,7 @@ echo
 echo '# special csh variables converted to bash equivalents'
 echo
 
-sed -e 's/'"$T"'/=/' < /tmp/cb$$.v |
+sed -e 's/'"$T"'/=/' < $vartmp |
 grep "^cdpath=" |
 sed 's/(//
      s/ /:/g
@@ -118,7 +125,7 @@ sed 's/(//
      s/cdpath=/CDPATH=/'
 
 
-sed -e 's/'"$T"'/=/' < /tmp/cb$$.v |
+sed -e 's/'"$T"'/=/' < $vartmp |
 grep "^mail=" |
 sed 's/(//
      s/ /:/g

Reply via email to