scripting

9 réponses [Dernière contribution]
bluzeo
Hors ligne
A rejoint: 08/27/2015

im about to be doing some scripting. i am really new and want to figure out the starting of a simple one that be useful for like setiing up date and time or finding the ip.

JadedCtrl
Hors ligne
A rejoint: 08/11/2014

You should probably read up on bash scripting-- there are plenty of fantastic books that'll help you do this.
Here's a pretty good one on WikiBooks: https://en.wikibooks.org/wiki/Bash_Shell_Scripting

bluzeo
Hors ligne
A rejoint: 08/27/2015

thanks - now to watch my anime and pick a editor - i got kwrite but im thinkimg that nano better.

jshaeffer9
Hors ligne
A rejoint: 11/06/2014

You may also want to look into vim (vi) and emacs as potential editors for scripting.

valentijn
Hors ligne
A rejoint: 08/28/2015

On 28/08, name at domain wrote:
> im about to be doing some scripting. i am really new and want to figure out
> the starting of a simple one that be useful for like setiing up date and
> time or finding the ip.
We meet again...

Anyways you should first start with learning a language or
shell. Generally people like Python, Bash and Zsh.

Python is langauge which has a ton modules which can do all kinds of
crazy stuff. I've a little script that checks my email and sends me
the unread emails. And I barely know basic Python.

Bash is the shell used by pratically everyone who uses a GNU/Linux
system and forms a good foundation for learning how to script.

Zsh is Bash with more features and has a ton of cool stuff like great
autocomplete, plugin frameworks (I like prezto), and themes.

But it is absolutely essential that you learn how to use the shell
effectively. Most of the stuff you want to do is achievable using
basic commands including changing music, showing you your volume
level, date, displaying a fortune cookie, ascii art, etc...

If you want to read up on someone who knows how to a lot of really
cool things with the shell I really recommend z3bra. There are also a
lot of really good resources on learning the shell which I'll link as
well.

[1] http://blog.z3bra.org/ (especially meeting at the bar and pop it
up)
[2] http://cli.learncodethehardway.org/
[3] https://github.com/sorin-ionescu/prezto
[4]
https://www.edx.org/course/introduction-linux-linuxfoundationx-lfs101x-2
(I really recommend this one for all things GNU/Linux)
[5]
http://www.amazon.com/How-Linux-Works-Superuser-Should/dp/1593275676
(The old version was my real introduction to Linux)
[6] http://programming-motherfucker.com/become.html#Bash
[7] http://programming-motherfucker.com/become.html#Python
--
Once the toothpaste is out of the tube, it's hard to get it back in.
-- H.R. Haldeman

bluzeo
Hors ligne
A rejoint: 08/27/2015

im watching my classes right now on linuxacademy- im going to to do hello world 2omrrrow!

tomlukeywood
Hors ligne
A rejoint: 12/05/2014

as well as bash you should also check out lua
which is a great scripting language!
https://www.youtube.com/watch?v=aSxoOCn6Y4E

t3g
t3g
Hors ligne
A rejoint: 05/15/2011

I would say to go with Python for the clear syntax, ease of use, documentation, and it being installed with every version of Trisquel!

A good starting point is Python 2.7 (installed under just python) but if you want to do Python 3, you can do that too. Just make sure that "python3" is installed via apt or aptitude ahead of time.

tomlukeywood
Hors ligne
A rejoint: 12/05/2014

i would say lua's syntax is just as or clearer than python's

also its a much simpler language as so its easier to learn as a first language

but anyway that’s just my opinion so i recommend trying both

onpon4
Hors ligne
A rejoint: 05/30/2012

It's comparing apples to oranges.

Python's great strength is that its standard library is huge. Just about anything can be done very easily in Python. And then, there are a ton of third-party libraries offering even more functionality. Basically, Python makes doing complex things much easier.

Lua, on the other hand, is extremely light and has flexible syntax.

I think Lua is an amazing language as an extension language. Something for adding stuff on to a primarily C-based (or C++-based) codebase. See Naev and Minetest, for example. Python, on the other hand, is much better as a primary language.