When filesystem is growing up, we need to analyse what is going on and why is our filesystem running out of space. The best for checking usage is combination of commands like df, du or find. to have it all in one place I wrote very simple and useful script which show largest files, largest directories or last attached/modified files.
For more professional like scripting is nice to use options, where we can do different work with one script just using it. In this article I will show you, how to write script, where we can switch what to do using options -h for help, or -e for echoing “hello world”. Of course, this is just example and we can use it for more complex work than just hello world :).
During scripting in environment, where is used more UNIX/Linux platform we must adapt our scripts for slight differences between those platforms. Here is little example how we can do it and few examples how is script working at different platforms.
During programming sometimes we need make script more interactive. There is little example how we can do such interactive script which is asking simple question about continuing and we will quit program by pressing “c” char. I hope this example is understandable for everyone.