2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00
koreader/plugins/terminal.koplugin/shfm_opener.sh
zwim f2557a7aa6
Terminal emulator: full rewrite, real vt52 emulator (#8636)
New real terminal emulator, replacing the old plugin.
The emulator is basically a vt52 terminal (enriched with
some ANSI-sequences, as ash, vi and mksh don't behave well
on a vt52 term).
So far working: ash, mksh, bash, nano, vi, busybox, watch...
The input supports: tab-completion; cursor movement;
backspace; start of line, end of line (long press);
page up, page down (long press).
User scripts may be placed in the koterm.koplugin/scripts/
folder, aliases can be put in the file aliases and startup
command in the file profile.user in that folder.
2022-01-28 20:33:09 +01:00

36 lines
590 B
Bash
Executable File

#!/bin/sh -e
#
# open file in application based on file extension
mime_type=$(file -bi "$1")
case "${mime_type}" in
application/x*)
./"$1"
echo "Application done, hit enter to return"
read -r
exit
;;
text/x-shellscript*)
./"$1"
echo "Shellscript done, hit enter to return"
read -r
exit
;;
esac
case "$1" in
*.sh)
sh "$1"
echo "Shellscript done, enter to return."
read -r
exit
;;
# all other files
*)
"${EDITOR:=vi}" "$1"
;;
esac