So here’s the deal. Soon I’ll be managing new responsibilities that involves serious knowledge of cPanel/WHM, and although I have experience working with this platform, I’ve been studying the cPanel documentation as if my life depends on it.
For the aforementioned purpose, I’ve been making my way through the documentation available in the cPanel University. So far it has been an outstanding resource. And incredibly enough, they offer this certification for free. They have my total respect for this.
One of the advantages of going through the cPanel University curriculum is that you can opt for taking the certification exam, which will be a valuable asset for your career.
Go ahead and sigh up. There’s nothing to lose and a lot to gain.
See you soon,
Have you ever tried to loop through a set of items in a for loop in bash just to discover that bash turns spaces into newlines making your script to break?
Well, if you are in a hurry, use this before starting the for loop and come back afterwards for an explanation of what happened there:
Your final result might look like this:
for stuff in `ls -1 | grep -iE '[a-z]+'`;
do du "$stuff" -hs;
Welcome back. Now, here’s what happened, IFS is a variable set by bash which contains a set of separators in order to perform word splitting. That is, every time bash is going to determine which sequence of characters will be considered as a single unit, it will assume as such each sequence of characters that it contained between separators.
By default, the shell will set IFS to contain 3 values as separators: spaces, tab, newlines. So, if one of the elements in your loop contains a character considered as a separator (in our case, the space) the shell will consider each set of character between spaces as one additional element.
In a more graphical example, the following element:
…would be considered as three different elements:
And from this point on your script will start to yield errors and unexpected results.
So, what we did to correct this was to override the value of IFS in order to having it only consider newline ($’\n’) as an element separator.
You can consult the bash man page for further information.
Feel free to leave a comment if you found this article helpful or think there’s something to improve about it.
I’ve just recently published a little Github project with the purpose of showing how to integrate CodeIgniter and the PHP SDK provided by Intuit in order to connect to Quickbooks Online services.
The idea is to continue working on it until it reaches some degree of maturity. It should not take too much time, but time is scarce lately.
I’m planning to create another project (sample application) which serves as a starting point of implementation, and a little article explaining the implementation process on real live scenarios.
See you later,
Hello there, I’m Pavel,
Maybe you’ve got here from the Spanish version of the Slackware Linux Project, or you might have stumbled upon the PE Category Filter plugin at WordPress’ official site.
In any case, welcome.
You might want to check my CV, LinkedIn or GitHub profiles.