sled

Једноставни уређивач текста
git clone https://git.sr.ht/~strahinja/sled
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

sledv (397B)


      1 #!/bin/sh
      2 # vim: set ft=bash:
      3 
      4 PAGER=${PAGER:-less}
      5 SLED=${SLED:-/usr/local/bin/sled}
      6 
      7 if [ $# -lt 1 ]; then
      8 	cat <<EOT >&2
      9 Usage: ${0##*/} [path] [arguments]
     10 	Test if path is writable; if it is, execute 'sled [arguments] [path]',
     11 	otherwise '\${PAGER:-less} [arguments] [path]'.
     12 EOT
     13 	exit 1
     14 fi
     15 
     16 path=$1
     17 shift
     18 
     19 if test -w "$path"; then
     20 	"${SLED}" "$@" "${path}"
     21 else
     22 	"${PAGER}" "$@" "${path}"
     23 fi