Gedit 无法启动

Gedit 无法启动

由于某种原因,gedit 无法启动。以下是它给出的输出:

chris@Chris-Ubuntu-Laptop:~$ gedit
chris@Chris-Ubuntu-Laptop:~$ 

描述性,让我们尝试一下帮助。

chris@Chris-Ubuntu-Laptop:~$ gedit --help
chris@Chris-Ubuntu-Laptop:~$ 

所以这也行不通。我试过让它打开一个文件。GUI 启动技术也失败了。Synaptic 和基于终端的重新安装尝试都失败了。唯一有效的方法是使用 sudo。不过我不想以超级用户身份运行,这样我就不会意外破坏某些东西(似乎没有帮助 :D)。哦,是的,我在运行一个我一直在测试的 shell 脚本时注意到了这一点。它在这里:

#/bin/bash

##Copyright 2012 Christopher David King
##Email: [email protected]
##
##This program is free software: you can redistribute it and/or modify
##it under the terms of the GNU General Public License as published by
##the Free Software Foundation, either version 3 of the License, or
##(at your option) any later version.
##
##This program is distributed in the hope that it will be useful,
##but WITHOUT ANY WARRANTY; without even the implied warranty of
##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
##GNU General Public License for more details.
##
##You should have received a copy of the GNU General Public License
##along with this program.  If not, see <http://www.gnu.org/licenses/>.

##usage: [-h]|[--help]|[-u] [filename] [mode]
##Helps to create new scripts. It will open them in a text editor of your choice (gedit by default) and give it the permissions you want (777 by default.)
##-u, uninteractive, will automatically overwrite scripts, and will fail if a file name is not supplied
##-h Display this help.
##--help Display this help.

if [ -w ~/bin ]; then cd ~/bin; fi #Work in the user's bin folder.

usage() #This is for help
{
    cat <<- _EOF_
    usage: [-h|--help] [-q|--quite] [filename] [text_editor] [mode]

    Helps to create new scripts. It will open them in a text editor of your choice (gedit by default) and give it the permissions you want (777 by default.)

    Options:

    -q, --quiet Will not prompt user for input. Will fail if no filename given. Will automatically overwrite files if necesary.
    -h, --help Display this help.
    _EOF_
}
interactive=0
if [ "$1" = "-q" ] || [ "$1" = "--quiet" ]; then
    interactive=1
    shift
fi

case $1 in
    "" ) if [ "$interactive" = "0" ]; then
            echo -n "What will you name your script? >" #In case they forgot, we do not want to crash
            read name
         else
        echo "No file supplied." 1>&2
        exit 1
         fi;;

    "-h" | "--help") usage
                     exit 0;;
    * ) name=$1;;

esac

mode=777 #A default
command="gedit +2 -b" #Also a default

case $2 in
    [0-8][0-8][0-8] ) mode=$2; shift;; #I will adapt it in the future to accept more values of chmod
esac

case $2 in
    "" ) :;;
    * ) command=$2
esac

if [ -f $name ] && [ "$interactive" = "0" ]; then
    echo -n "The file \"$name\" exists. Do you want to overwrite it? (y/n)>"
    read response
    if [ $response = 'n' ]; then
        echo "Exiting"
        exit 0
    fi
fi

echo -e "#/bin/bash\n\nexit 0" > $name #add in the first line of any shell script
$command $name #Go to line 2, since the first was already done for them. Also, make sure gedit doesn't close when the terminal does, and it doesn't block the terminal.
chmod $mode $name

exit 0

我希望这没有破坏它。

答案1

看起来您gedit的 上有虚假文件$PATH,可能是由该脚本创建的。尝试type gedit找出gedit实际启动的是哪个。

相关内容