Many scripts, require input from the user, or give output to the user as the script is running. This article describe how to pass arguments to script and make it non interactively, when we already know answers and we want to go thru script faster. Continue reading
Finding CPU and memory utilization is one of the important tasks. Linux comes with various utilities for reporting. Following article contain shell script which will help you to find it out how much CPU or Memory is consuming every user. Continue reading
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.
In shell scripting we often need to check if file or directory exists and take appropriate action. This post show you how to check it and how this check use in your script.
For checking we will use file test operators -f for file and -d for directory, which return TRUE if file or directory exists.
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.