added string search
This commit is contained in:
parent
91bfd4eea4
commit
bda7e9eace
14
en
14
en
@ -22,11 +22,12 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
help="$(printf "Commands:\n\
|
help="$(printf "Commands:\n\
|
||||||
|
/ – display lines containing a string.\n\
|
||||||
|
? – displays this help message.\n\
|
||||||
a – appends a line to the current buffer.\n\
|
a – appends a line to the current buffer.\n\
|
||||||
c – clears the screen.\n\
|
c – clears the screen.\n\
|
||||||
d – deletes a line.\n\
|
d – deletes a line.\n\
|
||||||
e – evaluates a command in the shell environment.\n\
|
e – evaluates a command in the shell environment.\n\
|
||||||
? – displays this help message.\n\
|
|
||||||
i – inserts a line into the buffer at position line.\n\
|
i – inserts a line into the buffer at position line.\n\
|
||||||
p – prints the current buffer.\n\
|
p – prints the current buffer.\n\
|
||||||
q – terminates editing.\n\
|
q – terminates editing.\n\
|
||||||
@ -56,6 +57,13 @@ while test -n "$1"; do
|
|||||||
read -r command args
|
read -r command args
|
||||||
|
|
||||||
case $command in
|
case $command in
|
||||||
|
"/")
|
||||||
|
if test -z "$args"; then
|
||||||
|
printf "%s: %s: Missing argument.\n" "$argv0" "$args"
|
||||||
|
else
|
||||||
|
printf "%s" "$content" | nl | sed -n "/$args/p"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
"?")
|
"?")
|
||||||
if test -z "$args"; then
|
if test -z "$args"; then
|
||||||
printf "%s: %s\n" "$argv0" "$help"
|
printf "%s: %s\n" "$argv0" "$help"
|
||||||