在管理外部工具中,創建啟動腳本
1 #!/bin/sh 2 DIR=$GEDIT_CURRENT_DOCUMENT_DIR 3 NAME=$GEDIT_CURRENT_DOCUMENT_NAME 4 /home/lxy/code/c/struct/run.sh ${DIR}/${NAME}
創建run.sh
#!/bin/sh file=$1 ext=${file##*.}#C if [ $ext = "c" ]; thenif [ -f $file ]; then#Complitegcc ${file} -o ${file%.*}#Run${file%.*}echo "\n\n"$fileelseecho "Please Input File !, ex: sh run.sh test.c"fi fi#Python if [ $ext = "py" ]; then/usr/bin/python ${file} fi
這段代碼會通過程序文件的擴展名,有選擇的運行編譯器,所以geditor只需要設置一個快捷鍵運行程序就可以了