LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2009, 05:57 AM   #1
jens1245
LQ Newbie
 
Registered: May 2009
Posts: 18

Rep: Reputation: 5
run command from .py in terminal


Hello,

I want to make a .py file which updates my system with the latest packages when i click it. This means i have to run the command:

sudo apt-get upgrade in the xfce4-terminal.

Currently my file looks like this, but it won't work, any suggestions?

#!/bin/sh
xfce4-terminal sudo apt-get upgrade

Thanks in advance!
 
Old 05-10-2009, 06:10 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Run xfce4-terminal --help and see which options can be useful for this task. For example:
Code:
xfce4-terminal -H -x sudo apt-get upgrade
Anyway, I don't see any python script in your post: am I missing something?
 
Old 05-10-2009, 06:44 AM   #3
jens1245
LQ Newbie
 
Registered: May 2009
Posts: 18

Original Poster
Rep: Reputation: 5
Thanks it works!, but one more question.

When I update, I want the terminal to close afterwards but it doesn't.

I typed:

Code:
xfce4-terminal -H -x sudo apt-get upgrade && exit
 
Old 05-10-2009, 06:54 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Remove the -H (hold) option. I suggested -H because when I run commands in terminal I want to keep it open to read standard output and standard error (if any) but it is not mandatory.
 
  


Reply


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
Terminal doesn't allow me to run the next command :( QueenZ Linux - Newbie 4 02-16-2009 09:39 AM
Terminal command: cannot run bootinst.sh gordon__1 Linux - Newbie 4 01-28-2008 03:11 PM
Run a command on another terminal. mpyusko Slackware 3 06-23-2007 04:44 AM
Run command on a different terminal jantman Linux - General 3 06-07-2006 02:32 PM
Is there a terminal command that I can run that will........... ludwig W Linux - Networking 20 11-28-2005 04:59 PM


All times are GMT -5. The time now is 04:08 PM.

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