add generic_func
This commit is contained in:
parent
ef851a2a47
commit
e091b6e87c
10
generic_func.sh
Executable file
10
generic_func.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
function view_file(){
|
||||
sys_name=`uname -s`
|
||||
if [[ ${sys_name} == 'Linux' ]]; then
|
||||
xdg-open ${1}
|
||||
elif [[ ${sys_name} == 'Darwin' ]]; then
|
||||
open ${1}
|
||||
fi
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
. gmt_shell_functions.sh
|
||||
# 包含dispOption脚本
|
||||
. dispOptions
|
||||
. generic_func
|
||||
# 定义一个函数 执行输入的语句或者将其显示在屏幕上
|
||||
RunOrEcho()
|
||||
{
|
||||
@ -299,9 +300,9 @@ else
|
||||
|
||||
# 在终端显示图像 此命令需要imgcat.sh脚本和iTerm终端
|
||||
#imgcat $jpgfile
|
||||
# 打开图片文件 此命令使用MacOS终端open命令
|
||||
# 打开图片文件 此命令使用MacOS终端open命令 和Linux下的xdg-open命令
|
||||
if [[ ${run_command} == 1 ]]; then
|
||||
open $jpgfile
|
||||
view_file ${jpgfile}
|
||||
fi
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user