再也不用手敲编译和运行啦!
添加以下命令(实现快捷键编译、运行)
编译(Compile)
#!/bin/sh
fullname=$GEDIT_CURRENT_DOCUMENT_NAME
name=`echo $fullname | cut -d. -f1`
suffix=`echo $fullname | cut -d. -f2`
echo "Compiling: " $GEDIT_CURRENT_DOCUMENT_PATH
echo '--------------------'
if [ $suffix = "f90" ];then
gfortran $fullname -o $name && echo "编译成功";
elif [ $suffix = "c" ];then
gcc $fullname -o $name && echo "编译成功";
elif [ $suffix = "cpp" ];then
g++ $fullname -o $name && echo "编译成功";
elif [ $suffix = "java" ];then
javac $GEDIT_CURRENT_DOCUMENT_PATH && echo "编译成功"
fi
![compile image](https://img-blog.csdn.net/20161217101417498?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvRWxsaW90dF9Zb2hv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
运行(Run)
#!/bin/sh
fullname=$GEDIT_CURRENT_DOCUMENT_NAME
name=`echo $fullname | cut -d. -f1`
suffix=`echo $fullname | cut -d. -f2`
dir=$GEDIT_CURRENT_DOCUMENT_DIR
gnome-terminal --hide-menubar --working-directory=$dir -t " 终端-$name" -x bash -c "$dir/$name; echo;echo '按回车键返回';read"
![run image](https://img-blog.csdn.net/20161217101430076?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvRWxsaW90dF9Zb2hv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
编译&运行(Compile&Run)
#!/bin/sh
fullname=$GEDIT_CURRENT_DOCUMENT_NAME
name=`echo $fullname | cut -d. -f1`
suffix=`echo $fullname | cut -d. -f2`
gcc $fullname -lpthread -o $name && echo "编译成功";
dir=$GEDIT_CURRENT_DOCUMENT_DIR
gnome-terminal --hide-menubar --working-directory=$dir -t " 终端-$name" -x bash -c "$dir/$name; echo;echo '按回车键返回';read"
以后只用按自己设置的快捷键就可以 编译、运行程序啦。