Ubuntu Forums

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Main Support Categories > General Help
Register Forum Information Ubuntu Community Search Today's Posts Mark Forums Read

General Help All your general support questions for Ubuntu, Kubuntu, Edubuntu, Xubuntu and Lubuntu.

 
Thread Tools Display Modes
Old August 28th, 2008   #1
abcuser
Dipped in Ubuntu
 
Join Date: Mar 2007
Beans: 597
How to execute bash script from menu?

Hi,
in Ubuntu 8.04 I would like to create menu shortcut to execute bash script file. Let just very simplify example. I have created file.sh where there is only one command:
echo "This is echo"

I have given privileges: chmod 777 file.sh

And put the command into menu: System | Preferences | Main menu.

I typed in Command field: /home/myuser/file.sh > /home/myuser/file.log

I tried Application and also "Application in Terminal". But there was no message in file.log file. I have also tried:
/home/myuser/file.sh 2> /home/myuser/file.log (note 2> to put only error messages into log file). And there is no message in file.log.

I don't understand how "menu" works. Is there any tutorial I could read more about how to set settings in "Main menu"?

Is there any simple way of entering bash script to menu?
Thanks,
Abcuser

Last edited by abcuser; August 28th, 2008 at 09:36 AM..
abcuser is offline   Reply With Quote
Old August 28th, 2008   #2
DGortze380
Fresh Brewed Ubuntu
 
DGortze380's Avatar
 
Join Date: Sep 2007
Location: Masschusetts
Beans: 1,510
Ubuntu 9.04 Jaunty Jackalope
Re: How to execute bash script from menu?

Quote:
Originally Posted by abcuser View Post
Hi,
in Ubuntu 8.04 I would like to create menu shortcut to execute bash script file. Let just very simplify example. I have created file.sh where there is only one command:
echo "This is echo"

I have given privileges: chmod 777 file.sh

And put the command into menu: System | Preferences | Main menu.

I typed in Command field: /home/myuser/file.sh > /home/myuser/file.log

I tried Application and also "Application in Terminal". But there was no message in file.log file. I have also tried:
/home/myuser/file.sh 2> /home/myuser/file.log (note 2> to put only error messages into log file). And there is no message in file.log.

I don't understand how "menu" works. Is there any tutorial I could read more about how to set settings in "Main menu"?

Is there any simple way of entering bash script to menu?
Thanks,
Abcuser
Make your script. Include any redirections to logs in the script. Put it anywhere you'd like. Create a launcher for the script. Add the launcher to the menu.
__________________
Registered Linux User: 482377
MacBook (1,1) - OS X Leopard
ASUS P5LD2 - Core 2 Duo 3.0GHz - 2GB Corsair RAM - Nvidia 8800GT - Ubuntu 9.04 / Windows 7 Professional
DGortze380 is offline   Reply With Quote
Old August 29th, 2008   #3
abcuser
Dipped in Ubuntu
 
Join Date: Mar 2007
Beans: 597
Re: How to execute bash script from menu?

Hi,
thank you very much. In bash file has to be the following command: /home/myuser/file.sh

And inside file.sh:
echo "This is echo" > /home/myuser/file.txt

Thanks a lot,
Abcuser
abcuser is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:22 PM.


vBulletin ©2000 - 2012, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. bilberry