Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
SUSE / openSUSE This Forum is for the discussion of Suse Linux.


  Search this Thread
Old 04-18-2010, 01:11 PM   #1
Registered: Jan 2006
Location: Austin
Distribution: openSUSE 11.2
Posts: 167

Rep: Reputation: 31
Smile KDE 4 Autostart Program Bash Script to Write Autostart Bash Scripts for You!

I wrote a simple Bash script that will create autostart program scripts for you in /home/user/.kde4/Autostart. Copy and past the following code into Kwrite or other editor and then save the file as autorun in the folder /home/user/bin. Use the command "chmod u+x autorun" to make the program executable.

# A sript file to create an Autostart script for a KDE Application
# KDE autostart script file name "autorun"
# Create script file /home/user/bin/autorun
# use the command "chmod u+x autorun" to make it executable
# Written for Forums 4-18-2010
# This program is ran in the Terminal mode with normal user rights
case "$1" in
"") echo 
    echo "--------------------------------------------------------------------------------------------------------------"
    echo "Must Enter Program name to be Automatically Run! The File Extension .sh is assumed and should not be entered."
    echo "1) To Add a New Autostart Program.          		Syntax is: autorun program "
    echo "2) To List All Programs in Autostart.       		Syntax is: autorun -l"
    echo "3) To Delete an Existing Autostart Program. 		Syntax is: autorun -d program"
    echo "--------------------------------------------------------------------------------------------------------------"
    read -p "Press <enter> to exit autorun..."
    echo ;;
"-l") echo "----------------------------------------------------" 
    echo "List of Autostart files:"
    dir /home/$USER/.kde4/Autostart	
    echo "------------------------------------------------------"
    read -p "Press <enter> to exit autorun..." ;;
"-d") cd ~
      if [ "$2" != "" ] ; then
	if [ ! -f .kde4/Autostart/$ ] ; then
	  echo "---------------------------------------------"
	  echo "Autostart file: "$2".sh Does Not Exist!"
	  echo "---------------------------------------------"
	  read -p "Press <enter> to exit autorun..."
	  rm .kde4/Autostart/$
	  echo "---------------------------------------------"
	  echo "Deleted the Autostart File: "$2".sh"
	  echo "---------------------------------------------"
	  read -p "Press <enter> to exit autorun..."
 	  echo "------------------------------------------------------------------------"
	  echo "The Delete Option Must be followed by an Autostart filename to Delete!"
	  echo "                 Syntax is: autorun -d program"
	  echo "------------------------------------------------------------------------"
	  read -p "Press <enter> to exit autorun..."
      fi	;;
*)  cd ~
    echo "#!/bin/bash" > .kde4/Autostart/$
    echo $1 $2 $3 $4 >> .kde4/Autostart/$
    chmod u+x .kde4/Autostart/$
    echo "------------------------------------------------------------------"
    echo "Created Script File "/home/$USER/.kde4/Autostart/$
    echo "------------------------------------------------------------------"
    read -p "Press <enter> to exit autorun..."	;;
# End Script File
To use the program, open up a terminal session and type "autorun program" to create an autostart script file for you. Autorun allows to to create, list and delete autostart bash script files. When using a program name, it must be the actual name you must type in in the run command box, to make it work. If a program you wish to run requires options, add them to the end of your program name. Ex: autorun kwrite textfile.

Thank You,

Last edited by jdmcdaniel3; 04-27-2010 at 09:54 PM.
Old 05-03-2010, 06:17 AM   #2
Senior Member
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 249Reputation: 249Reputation: 249
I'm sure it's useful for KDE users, thanks.


application, autostart, bash, kde4, startup

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to autostart a bash script when DSL loads the Desktop?? linus72 Linux - Newbie 5 04-08-2009 01:12 PM
script for restarting ntpd in /home/user/.kde/autostart farpoint Fedora 2 12-12-2005 01:46 PM
How do I create a script to start up in .kde/Autostart? Slovak Slackware 11 11-30-2004 06:21 PM
Bash aliases won't autostart? Ollir Mandriva 7 08-22-2004 02:10 PM
.kde/Autostart bash scripts "file not found" Nice-n-Slow Linux - Software 1 07-02-2004 05:25 PM > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 05:29 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration