summaryrefslogtreecommitdiff
path: root/examples/scripts
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2002-07-17 14:10:11 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:55 +0000
commit7117c2d221b2aed4ede8600f6a36b7c1454b4f55 (patch)
treeb792f26ecca68813c51ed5ba2e381790758ef31b /examples/scripts
parentf73dda092b33638d2d5e9c35375f687a607b5403 (diff)
downloadbash-7117c2d221b2aed4ede8600f6a36b7c1454b4f55.tar.gz
Imported from ../bash-2.05b.tar.gz.devel-base-dist
Diffstat (limited to 'examples/scripts')
-rwxr-xr-xexamples/scripts/bcsh.sh6
-rw-r--r--examples/scripts/self-repro9
-rwxr-xr-xexamples/scripts/vtree22
3 files changed, 13 insertions, 4 deletions
diff --git a/examples/scripts/bcsh.sh b/examples/scripts/bcsh.sh
index 9d93b305..509fe885 100755
--- a/examples/scripts/bcsh.sh
+++ b/examples/scripts/bcsh.sh
@@ -335,7 +335,7 @@ if test -s "$histfile"
then
cmdno="`set - \`wc -l $histfile\`;echo $1`"
cmdno="`expr \"$cmdno\" + 1`"
- lastcmd="`tail -1 $histfile`"
+ lastcmd="`sed -n '$p' $histfile`"
copy=false
ohist=$histfile
while test ! -w "$histfile"
@@ -689,7 +689,7 @@ esac/
rest=
;;
esac
- i="`grep \"$wanted\" $histfile | tail -1`"
+ i="`grep \"$wanted\" $histfile | sed -n '$p'`"
;;
*)
# find which 'start-of-command' match is wanted
@@ -708,7 +708,7 @@ esac/
rest=
;;
esac
- i="`grep \"^$wanted\" $histfile | tail -1`"
+ i="`grep \"^$wanted\" $histfile | sed -n '$p'`"
;;
esac
diff --git a/examples/scripts/self-repro b/examples/scripts/self-repro
new file mode 100644
index 00000000..951d4e40
--- /dev/null
+++ b/examples/scripts/self-repro
@@ -0,0 +1,9 @@
+# self-reproducing script (except for these comment lines -- remove them)
+# i got this from the ksh93 faq:
+# http://www.kornshell.com/doc/faq.html
+#
+n="
+" q="'" x="cat <<-!" y=! z='n="$n" q="$q" x="$x" y=$y z=$q$z$q$n$x$n$z$n$y'
+cat <<-!
+n="$n" q="$q" x="$x" y=$y z=$q$z$q$n$x$n$z$n$yb
+!
diff --git a/examples/scripts/vtree2 b/examples/scripts/vtree2
index 62aa9486..878cbabc 100755
--- a/examples/scripts/vtree2
+++ b/examples/scripts/vtree2
@@ -32,7 +32,7 @@ do
cd "$1" || { shift; [ $# -ge 1 ] && echo >&2; continue; }
echo -n "$PWD"
- du $andfiles | sort +1f | sed \
+ du $andfiles | sort -k 2f | sed \
-e 's/\([^ ]*\) \(.*\)/\2 (\1)/' \
-e "s#^$1##" \
-e 's#[^/]*/\([^/]*\)$#|____\1#' \