Gedit在新窗口中打开然后新选项卡

时间:2012-07-18 18:57:37

标签: bash tabs gedit new-window

我正在尝试做的是让Gedit打开一个新窗口,然后在新窗口中打开一个新标签,同时让Gedit打开。我正在写的剧本有点大,有570行,所以这里除了它之外还有一些。

File1="test"
File2="test2"
function Gedit() {
    local newwindow

    if [ "$2" == "yes" ]; then
         newwindow="--new-window"
    fi

    gedit $newwindow $1 & # & is Very Important b/c of KVIrc
}
function FunctionA {
    Gedit $a "yes"
    Gedit $b 
}

FunctionA

我想通了,最后是&符号(&)。但是如上所述,这非常重要,因为当我运行我的脚本时,我在KVIrc中运行它。如果我取出&,KVIrc等待Gedit完全关闭。我尝试使用gedit -s--name--sm-client-id。我也尝试使用coproc,这真的不起作用。任何帮助将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:0)

好的,这就是我解决它的方法:

function OpenWithGedit() {
local newwin=$1
shift
local outfile ofile i
local newwindow

#splits $@ into two parts
ofile=${@:1:$(($#/2))}
outfile=${@:$(($#/2+1)):$#}

if [ "$newwin" == "yes" ]; then
    newwindow="--new-window"
fi 

for i in $outfile
do
    SayE "Gedit" $i #echos $i with some format
done
gedit $newwindow $ofile &
}

此命令的格式如下:

OpenWithGedit "yes" $File1 $File2 $File3 $File1Out $File2Out $File3Out

您可以拥有所需数量的$ Files。

相关问题