Discussion on:

6
Comments

Join the conversation!

Follow via:
RSS
Email Alert
cat file.txt | xargs rm -f

I know i know, you wanted to show a script.
I am NOT a programmer or a script maven, but I often have to cobble together a script or two to get specific things done. In an attempt to get things done I have scanned through many texts in books and online and never has this simple explanation be provided.

I have only read two books that have taken an overview of creating instructions, (one was an old NT scripting book that I still have somewhere and the other was a book that took the view that you could look at programming through the tasks you need to do and figure out how to do things you want to do by asking the question, "How would you do that task in this language.") both helpful, but I would like to see a book with this overview written about both programming and scripting. There are many good books on specific languages that usually dive right into information packed pages on specific uses of the language.

This article would be a great introduction to a simple book on the simple tasks that most people need to do with a script as well as a book of the same caliber on doing simple programming as a follow-up. I would like to see the first chapter be something like:

I want to do these things. Is it better to learn a programming language and use it to fix my problem or can it be done with a scripting language? How do you pick which tool for which job? A task oriented book or series of articles is rare to be found.

No one actually discusses the problem to be FIXED first and then starts at the beginning to explain how you get to what tools to use, and THEN how you use them as well as why they are the best solution. The best tool for the best job.

As an example the problem of your reader, lay out a task a simple task and show how it is done with simple examples of scripts in each OS.

Mike
you can easily forget about learning a full programming language like C+, you wont need it.

Scripts and programs are the same thing; lists of instructions. The difference is that a script controls an OS, giving it complex instructions eg moving tagged or named files from one place to another. A program is a list of lower level instructions that by comparison, creates file structures, reads and writes data bytes and performs complex mathematics.
Programs often have interfaces too, where scripts do not, although this is not a definition, just a convention.

All script languages should be able to to anything the OS can, so choosing one is a matter of preference. The author mentions Perl, however Ruby is more usually installed on a Mac or Windows, and Linux will often have both.

However, I'd recommend Python, because it runs on everything and is simpler to learn in my opinion. It is also more 'OS agnostic' than the others, behaving the same regardless of the host OS. This is helpful when googling how to do something; you will get one approach instead of 2 or 3 different ones.
Because, under the hood, it's UNIX.
Another good option for Windows to run Linux shell scripts is using GnuWin utilities. You can download package CoreUtils for Windows from http://gnuwin32.sourceforge.net/packages/coreutils.htm. It takes only about 6 Mb (compare to Cygwin's size!) and let me run your sample script on Windows7 really!
0 Votes
+ -
msys
joelschuster 4th Feb
Check out msys first from mingw. A much simpler install and much smaller one as well.
Keyboard Shortcuts:
Prev
Next
Toggle
Join the conversation
Formatting +
BB Codes - Note: HTML is not supported in forums
  • [b] Bold [/b]
  • [i] Italic [/i]
  • [u] Underline [/u]
  • [s] Strikethrough [/s]
  • [q] "Quote" [/q]
  • [ol][*] 1. Ordered List [/ol]
  • [ul][*] · Unordered List [/ul]
  • [pre] Preformat [/pre]
  • [quote] "Blockquote" [/quote]

Join the TechRepublic Community and join the conversation! Signing-up is free and quick, Do it now, we want to hear your opinion.