How do I write 'batch' files (dos terminology)

The place to discuss build upgrades, operating system installs, and all the hacks you've done or need to do!

How do I write 'batch' files (dos terminology)

Postby stevenpirie » Tue Mar 04, 2008 8:17 pm

I have installed winzig, and treeline. Both are written in python.
I had to install PyQt to get treeline to work.
I want to write simple executable scripts that will launch these apps, rather than cd-ing into directories and typing python xxxxx.py commands.

In the old DOS days, i would write batch files, what are the linux equivalents, and can I associate them with a clickable icon from the home view?
stevenpirie
 
Posts: 10
Joined: Wed Jan 09, 2008 5:36 pm

Re: How do I write 'batch' files (dos terminology)

Postby ektoric » Tue Mar 04, 2008 8:50 pm

What you're looking for are "shell scripts". Specifically, you are looking for "bash shell scripts", but the bash shell is a superset of the sh shell. If you google for those terms, you should be able to find what you're looking for.

In short, all you have to do is create a text file that has those shell script commands, and make that file executable,
Code: Select all
chm od  +x  myscript.sh

(Note: that's one word, "ch-mod", no dash, no space. The forum is interpreting that as a script command itself and won't let me post as it keys in on that keyword.)

Then you can run it directly,
Code: Select all
./myscript.sh
ektoric
Support Team
 
Posts: 428
Joined: Wed Jan 02, 2008 7:46 pm
Location: Austin, TX

Re: How do I write 'batch' files (dos terminology)

Postby ektoric » Tue Mar 04, 2008 8:52 pm

stevenpirie wrote:and can I associate them with a clickable icon from the home view?

As for clickable icon, you want to make an Activity. See http://wiki.laptop.org/go/Creating_an_activity

In which case, you don't want to create bash shell script, and may want to pick up a python book.
ektoric
Support Team
 
Posts: 428
Joined: Wed Jan 02, 2008 7:46 pm
Location: Austin, TX

Re: How do I write 'batch' files (dos terminology)

Postby stevenpirie » Wed Mar 05, 2008 3:05 am

so...
how close to python is pippy?
if i buy a python book, can i use it to learn pippy?
now that i have pyqt can i simply get or do i have python aleady.
should i avoid pippy and focus on python?
stevenpirie
 
Posts: 10
Joined: Wed Jan 09, 2008 5:36 pm

Re: How do I write 'batch' files (dos terminology)

Postby Gleth » Wed Mar 05, 2008 1:16 pm

stevenpirie wrote:so...
how close to python is pippy?
if i buy a python book, can i use it to learn pippy?
now that i have pyqt can i simply get or do i have python aleady.
should i avoid pippy and focus on python?


Pippy is a python IDE... kinda. It's proper python and you can enter the examples from any python book and pippy will run them happyly. Pippy made me decide to finally get around to learning a programming language again, so it and a couple of books, plus a nice tutorial in pdf format off the python.org website are all getting regular use.
Gleth
 
Posts: 23
Joined: Tue Jan 29, 2008 10:36 pm

Re: How do I write 'batch' files (dos terminology)

Postby HoboPrimate » Wed Mar 05, 2008 4:34 pm

I recommend the ebook Byte of Python http://www.byteofpython.info/ for non-programmers wanting to learn python programming.
HoboPrimate
 
Posts: 44
Joined: Fri Dec 28, 2007 3:45 am

Re: How do I write 'batch' files (dos terminology)

Postby lancemiller » Wed Mar 19, 2008 7:48 am

How does one put new python scripts in XO Pippy? I'm using bash command line to script and simply navigate through directories, if there is a directory to simply place new scripts please state it explicitly.

BTW, I'm no python pro.
lancemiller
 
Posts: 1
Joined: Wed Mar 19, 2008 4:33 am


Return to Sugar, Linux and System Software

Who is online

Users browsing this forum: No registered users and 2 guests