sd -- a drop-in replacement for `cd'

Check-in [5b18ec4ca0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:ensure sane input to `sdman'. remove (apparently redundant) use of `eval'.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5b18ec4ca0d23d6f14c7d01297d97257c953c54b
User & Date: vdh 2019-12-28 10:58:55
Context
2020-02-19 19:09
adjust zsh settings (sdclean now uses arrays etc.). check-in: eea7cae549 user: vdh tags: trunk
2019-12-28 11:01
ensure sane input to `sdman'. remove (apparently redundant) use of `eval'. check-in: ed15a9ba9f user: vdh tags: mksh
2019-12-28 11:01
ensure sane input to `sdman'. remove (apparently redundant) use of `eval'. check-in: 62858ad55b user: vdh tags: ksh
2019-12-28 10:58
ensure sane input to `sdman'. remove (apparently redundant) use of `eval'. check-in: 5b18ec4ca0 user: vdh tags: trunk
2019-12-22 16:55
replace piping of `print' output into commands by `<<<' here strings whereever possible. some other minor edits. check-in: eed377262a user: vdh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to sd.ksh.

81
82
83
84
85
86
87

88
89
90
91
92
93
94
95
sdshellcheck || { unset -f sdshellcheck; return 1; }


function sdman {  ## formatter
#---------------
#an inline manpage. `formatter' should be `[ng]roff -man'.
if [[ $# == 0 ]]; then set nroff -man; fi

cat <<-HERE | eval $* | less -R
.\"----------------------------------------------------------
.TH SD 1 "13. March 2016"
.nh
.SH NAME
sd \- switch between directories using a dynamic directory stack
.SH SYNOPSIS
.SY sd







>
|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
sdshellcheck || { unset -f sdshellcheck; return 1; }


function sdman {  ## formatter
#---------------
#an inline manpage. `formatter' should be `[ng]roff -man'.
if [[ $# == 0 ]]; then set nroff -man; fi
[[ $* == [ng]roff\ -man ]] || return   # be paranoid: ensure benign content of $*
cat <<-HERE | $* | less -R
.\"----------------------------------------------------------
.TH SD 1 "13. March 2016"
.nh
.SH NAME
sd \- switch between directories using a dynamic directory stack
.SH SYNOPSIS
.SY sd
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
      stacksize=$(sdlinecount "$sdlist")
      mostlen=${#most}
      i=0
      while ((i < indent0+mostlen)); do
         indent+=" "
         ((i++))
      done
      top=$($awk -F'\t' 'NR <= 10 {print $(NF-1) "\t" $NF}' <<< "$sdlist" )
      top=${top//$'\n'/$'\n'$indent}
   } || stacksize=0

   vdir=${dirv/#$HOME/\~}


   report="







|







760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
      stacksize=$(sdlinecount "$sdlist")
      mostlen=${#most}
      i=0
      while ((i < indent0+mostlen)); do
         indent+=" "
         ((i++))
      done
      top=$($awk -F'\t' 'NR <= 10 {print $(NF-1) "\t" $NF}' <<< "$sdlist")
      top=${top//$'\n'/$'\n'$indent}
   } || stacksize=0

   vdir=${dirv/#$HOME/\~}


   report="