PDA

View Full Version : Sh



WiLLiX86
February 3rd, 2008, 11:29 PM
Can everyone give me good examples of what you can do with SH Scripting?

LaRoza
February 3rd, 2008, 11:35 PM
What do you want to do?

See: http://laroza.pbwiki.com/Specific for Shell Scripting tutorials.

I recently wrote a shell script that allows a user to easily restore and backup all installed packages in case of a problem later. It is fully GUI.

WiLLiX86
February 3rd, 2008, 11:39 PM
A friend of mine whos a great systems guy said it would be very useful to learn SH, I'm learning about DNS/Bind servers and such. But wanted to know a wide varity of examples for what you can do with SH.

LaRoza
February 3rd, 2008, 11:42 PM
A friend of mine whos a great systems guy said it would be very useful to learn SH, I'm learning about DNS/Bind servers and such. But wanted to know a wide varity of examples for what you can do with SH.

I am not good with shell scripting, and usually prefer Python for tasks, so I can't give much advice on shell scripting.

You can investigate Shell scripting, Perl, Python, and Ruby to see what best suites your needs. They are different in many ways, but they overlap in many areas.

My wiki can get you started on any of them.

pmasiar
February 4th, 2008, 04:09 AM
A friend of mine whos a great systems guy said it would be very useful to learn SH, I'm learning about DNS/Bind servers and such. But wanted to know a wide varity of examples for what you can do with SH.

Maybe your friend is old hand who uses sh for 20 years now? Python was designed to be shell-like and extensible modern language - and you can use it beyond shell capabilities to generic file parsing and data massaging, and also more complex tasks, up to web app development.

Check libraries of course - language what has libraries you needs beats language which lacks them every time :-) but my bet is libraries you nned are ither in standard distro or in Python third-party module repository - Cheeseshop.

amingv
February 4th, 2008, 04:33 AM
I am not handy with bash scripting, but I have used it to automate some simple tasks I need done. Still, from what I have seen, you are able to do almost anything you like with it...

Here's some stuff people do...
http://ubuntuforums.org/showthread.php?t=616875


Maybe your friend is old hand who uses sh for 20 years now? Python was designed to be shell-like and extensible modern language - and you can use it beyond shell capabilities to generic file parsing and data massaging, and also more complex tasks, up to web app development.

**sigh** //Puts on +10 Fire Armor

ruy_lopez
February 4th, 2008, 06:55 AM
Sounds like you are coming at shell scripting from a sys-admin viewpoint.

These books have plenty of bash examples for sys-admins:

Classic Shell Scripting
http://www.oreilly.com/catalog/shellsrptg/index.html

Unix Power Tools
http://www.oreilly.com/catalog/upt3/index.html

"Unix Power Tools" is a great all-round command-line reference. I haven't read "Classic Shell Scripting". I leafed through it in Borders. I've been told good things about it.

Check out the examples for the books on Oreilly's website to see if they do what you want.

Click Here (http://examples.oreilly.com/shellsrptg/) for "Classic Shell Scripting" examples, and
click Here (http://examples.oreilly.com/upt3/) for "Unix Power Tools" examples.

Compyx
February 4th, 2008, 06:59 AM
Here's a few handy links:

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://tldp.org/LDP/abs/html/

These are about Bash, but should give you a pretty good idea what you can do with shell scripting. By default, Ubuntu uses Dash, not Bash, so perhaps not all examples will work properly, but you can always change your preferred shell to bash.