Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a perl script that runs from the terminal on Linux. I would like to be able to boot up, and when my desktop environment starts it will automatically open my terminal, and pass in the arguments to star this program, which are ./ttytter.txt -ansi -mentions -vcheck.

How can I go about doing this?

share|improve this question
add comment

2 Answers 2

Sometimes we do need to run programs in a terminal, can do like this:

xterm -e "sh -c './ttytter.txt -ansi -mentions -vcheck ; read"

The final "read" waits for you to press enter, to close the terminal.

You can use a different terminal program, and instead of "read" at the end you can run a shell, e.g.:

gnome-terminal -e "sh -c './ttytter.txt -ansi -mentions -vcheck ; exec bash'"

For some terminals (xterm) you might not need the sh -c '' wrapper; for some (gnome-terminal) we apparently do need that.

You can put such a command in .xinitrc, .xsession, or type it into a "run at startup" dialog.

You can also I think do this with a freedesktop .desktop file / shortcut, if you select "run in terminal", not sure how off the top of my head. That would be a much user friendly way to do it! See if you can figure that out...

Now, if you want to do it in general for any shell command, need to worry about shell escaping - and it becomes more difficult! Or, can put your command into a script and run the script.

It might also be helpful to see the command's exit status, like echo $? where 0 means success.

Sorry for over-complex answer, I hope it can help.

share|improve this answer
    
Complex is great! Ill give it a shot –  Simon Sheehan Jan 7 '13 at 11:47
add comment

You don't need to explicitly start a terminal. Just add your Perl script to ~/.xsession, any commands in that file will be run following a graphical login.

share|improve this answer
    
I need to open the terminal to see the output though. –  Simon Sheehan Jan 6 '13 at 17:20
    
Redirect the output to a file (script.pl > filename) and then add gedit filename to your .xsession file. –  terdon Jan 6 '13 at 21:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.