PDA

View Full Version : Script To Execute Command?



cchung85
August 16th, 2008, 12:02 AM
Hey guys, I recently downloaded this program that runs from it's extracted folder, I don't know how to make it install on the computer but I'd like to make a script for it so that I can access it easily on my AWN dock.

Here is what I have to do to get it to run:

1. "cd Desktop/brainworkshop"
2. in Desktop/brainworkshop I type "python brainworkshop.pyw"

Then the file opens and I get to run my program. I want to add it to my menu in either Gnome or Openbox, how would I do that?

Also, while I am at it... I tried to run the file in one line in terminal so I typed:

"cd Desktop/brainworkshop/"python brainworkshop.pyw"

I am pretty sure that doesn't work because it's trying to access a directory... How would I go about writing that line in terminal.
(how do I open a file with a program from a specific folder in one line?)

I think I am just going to confuse you guys so I'll stop here. Anyways, please help me out, I am trying to learn some commands for the terminal...

eriqjaffe
August 16th, 2008, 12:36 AM
You should be able to just run:


python ~/Desktop/brainworkshop/brainworkshop.pyw

Bachstelze
August 16th, 2008, 02:23 AM
And if you want to be able to run your script with just one command, add a line like this as the first line on your script:


#!/usr/bin/env python

and make it executable:


chmod +x ~/Desktop/brainworkshop/brainworkshop.pyw

Then you can for example copy it somewhere in your PATH:


sudo cp ~/Desktop/brainworkshop/brainworkshop.pyw /usr/local/bin/brainworkshop

And voilą:


brainworkshop

cchung85
August 16th, 2008, 05:22 AM
And if you want to be able to run your script with just one command, add a line like this as the first line on your script:


#!/usr/bin/env python

and make it executable:


chmod +x ~/Desktop/brainworkshop/brainworkshop.pyw

Then you can for example copy it somewhere in your PATH:


sudo cp ~/Desktop/brainworkshop/brainworkshop.pyw /usr/local/bin/brainworkshop

And voilą:


brainworkshop

I haven't tried it yet, I'm trying to figure out what each of those commands mean, I haven't toyed around with chmod yet... Will post in a bit about the results.

gareththomasnz
August 9th, 2010, 04:52 PM
I am trying to create a launcher for this very same application.

Can somebody please walk me through it - i don't want the folder on my desktop either.

cheers

Bachstelze
August 9th, 2010, 04:57 PM
Have you tried what I wrote above?

anjexe
March 31st, 2011, 05:18 PM
i want script to do so commands

1-cd acpi_call

2-sudo insmod acpi_call.ko

3-./test_off.sh

help me on how to do

d3v1150m471c
March 31st, 2011, 05:23 PM
append the following to ~/.bashrc :


alias nameofcommand="/path/to/command"
then,


. ~/.profile
now you can launch the program from any terminal with the chosen command. btw, was it a tar file? it probably has to be compiled and installed with `make' and `install'.

anjexe
March 31st, 2011, 06:19 PM
Using acpi_call module to switch on/off discrete graphics card in Linux

One of the hybrid-graphics-linux Launchpad team members has
created a Linux kernel module to call ACPI methods through
/proc/acpi/call. The code is here:

http://github.com/mkottman/acpi_call

You can try it by installing the module and calling it like this:

git clone http://github.com/mkottman/acpi_call.git

cd acpi_call

make

sudo insmod acpi_call.ko

./test_off.sh


orginaly it is about the above

some more clear help please
i dont know how to do it at all
tnx

supergirlkara
April 6th, 2011, 05:19 AM
There is also the perl alternative...




#!/usr/bin/perl;

system('1st command');

system('2nd command');

system('3rd command');

save file as auto.pl

from terminal type: perl auto.pl

anjexe
April 6th, 2011, 06:39 PM
There is also the perl alternative...




#!/usr/bin/perl;

system('1st command');

system('2nd command');

system('3rd command');

save file as auto.pl

from terminal type: perl auto.pl

how to gave the toot privilage (sudo)??