tisdag 10 mars 2015

Liinux - Kör bash sccript ifrån "genväg" .desktop i konsole med vald .sh fil






























the file: konsole: do.sh

[Desktop Entry]
Comment=hynt@speed-mailer.co
Comment[en_US]=hynt@speed-mailer.co
Exec=/home/hynt/Skrivbord/do.sh
GenericName=
GenericName[en_US]=
Icon=xorg
MimeType=application/x-shellscript;
Name[sv]=konsol: do.sh
Name=konsol: do.sh
Name[en_US]=run .sh file in konsole
Path=/home/hynt/Skrivbord
StartupNotify=false
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=hynt

the file: do.sh

#!/bin/bash
#!/bin/sh
clear
echo "hello! this bash run: "
echo "o dpkg --configure -a "
echo "o apt-get -f install  "
echo "                      "

#---------------------------------------------------------------------
echo "Run dpkg --configure -a [y/n]?"
read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]
then
echo "'yes'"
sudo dpkg --configure -a
fi
if [ $ans = n -o $ans = N -o $ans = no -o $ans = No -o $ans = NO ]
then
echo "'no'"
fi
 return $TRUE
}
#---------------------------------------------------------------------

#---------------------------------------------------------------------
echo "Run apt-get -f install [y/n]?"
read ans
if [ $ans = y -o $ans = Y -o $ans = yes -o $ans = Yes -o $ans = YES ]
then
echo "'yes'"
sudo apt-get -f install
fi
if [ $ans = n -o $ans = N -o $ans = no -o $ans = No -o $ans = NO ]
then
echo "'no'"
fi
 return $TRUE
}
#---------------------------------------------------------------------

#---------------------------------------------------------------------
#else then run .desktop it close bash script
echo -n "To Exit press [ENTER]: "
read var_name
#---------------------------------------------------------------------

hynt@speed-mailer.com
Skicka en kommentar