-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopen.sh
More file actions
executable file
·39 lines (35 loc) · 777 Bytes
/
open.sh
File metadata and controls
executable file
·39 lines (35 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
function main() {
if [[ -d "$@" ]]; then
nautilus "$@"
exit 0
fi
local ext="${@##*.}"
ext=$(printf "$ext" | tr '[:upper:]' '[:lower:]')
# nohup cmd "$@" >/dev/null 2>&1 &
case $ext in
n64)
nohup mupen64plus "$@" >/dev/null 2>&1 &
;;
gba)
nohup mednafen "$@" >/dev/null 2>&1 &
;;
pdf)
nohup evince "$@" >/dev/null 2>&1 &
;;
mkv|mid|midi|mp4|mp3|avi|mid|midi|flac|ogg|ogv|wav)
nohup vlc "$@" >/dev/null 2>&1 &
;;
txt|py|c|cpp|cc|log|out|java|ly)
nohup gedit "$@" >/dev/null 2>&1 &
;;
zip|rar|tar|jar|gz|tgz|bz2)
nohup file-roller "$@" >/dev/null 2>&1 &
;;
*)
printf "unknown file type: $ext\n"
exit 1
;;
esac
}
main "$@"