BASH Shell: For Loop File Names With Spaces

Posted on in Categories File system, Linux, UNIX last updated December 9, 2008

BASH for loop works nicely under UNIX / Linux / Windows and OS X while working on set of files. However, if you try to process a for loop on file name with spaces in them you are going to have some problem. For loop uses $IFS variable to determine what the field separators are. By default $IFS is set to the space character. There are multiple solutions to this problem.

Shell Scripting: Create Report / Log File Names With Date in Filenames

Posted on in Categories Debian Linux, Howto, Linux, RedHat/Fedora Linux, Shell scripting, Solaris, Suse Linux, Tips, Ubuntu Linux, UNIX last updated February 5, 2006

Sometime you need to create a shell scripts with output filenames with date in it. For example instead of log file named “secure.log”, you can create a filename called “secure-jan-02-06.log” or “secure-DATE-FORMAT.log”. The DATE-FORMAT can be set as per requirements:
=> dd-mm-yyyy
=> mm-dd-yyyy
=> yyyy-mm-dd
=> Month-Day-Year