diff options
Diffstat (limited to 'examples/scripts')
-rwxr-xr-x | examples/scripts/bcsh.sh | 6 | ||||
-rw-r--r-- | examples/scripts/self-repro | 9 | ||||
-rwxr-xr-x | examples/scripts/vtree2 | 2 |
3 files changed, 13 insertions, 4 deletions
diff --git a/examples/scripts/bcsh.sh b/examples/scripts/bcsh.sh index 9d93b30..509fe88 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 0000000..951d4e4 --- /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 62aa948..878cbab 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#' \ |