newbie's script ideas
I am a linux newbie. I have ideas for scripts and would like some constructive input on how practical they seem to more experienced users.
First I am thinking of making some basic scripts to retrieve information, ie: If I have loads of text files about... say people(each file about 1 person) with "age:xx" and "name:xx" on different lines(1 field per line) and I want a script to retrieve various data relative to input: Run script, then as prompted enter age >20, and script gives me the names of all people older than 20 and writes the names to a txt file and sends somewhere to print it. I know there are database programs that can do this. But I think using a terminal, script and text files would be much quicker, as it only processes exactly what is needed as I run the script. I also use text files a lot so I can use them everywhere without having to install software setup for the right os etc, plus the fact that they are small and tidy. I also believe some limitations of programmed software does not apply to scripts, as If I wanted to create user accounts based on the script I just detailed I could add another section to the script to create accounts based on the names it retrieves, where as a database program would not be programmed to do this because software is only designed to do specific tasks, and correct me if I am wrong, using scripts you can do quite a multitude of different functions? Another more complicated script I was thinking of was to backup data. I work on different computers to do different things, but I use the same files on all of them so when I actually get around to networking them I would like to make a script that automatically updates the other machines when I modify a file on one of them, say computer A, I add/modify some files, a script could check dates or existence of file, and if computers B and C are out of date, the script would automatically copy the new/modified file to those machines. And I could make the script run automatically every hour so I do not have to even worry about it. This would save me having to write down the files I modified every time I do so before manually backing up. These sound like a great ideas to me but being a newbie I wonder if I am missing some obvious realities? So your thoughts are welcome. If you think something is a good idea or a stupid idea, explain your reasons. Thanyou Nick |
For writing scripts, there are lots of tutorials on the net. Use google to find them.
O'Reilly do a really good book "Classic Shell Scrpiting", which beats all the net tutorials, but it's $35. For backing up like you suggest, please take a look at the rsync command. And welcome to LQ! |
I would like input on how practical the functionality of my script ideas are, relative to efficiency I suppose.
Not how to actually write the scripts. Saying that, some actual programming pointers would be helpful. Book adverts, not so helpful. However I will look into that rsync command.... Thanks for replying. Input on practicality anyone? |
These are fairly practical... not very hard if you know what you're doing.
|
Good. They did sound very practical to me. Guess I was being paranoid.
I think I can manage the scripts, the hard part is sorting out networking my computers first. Then I can have fun with scripting. |
All times are GMT -5. The time now is 04:01 AM. |