scripting – performance improvement with file open

2020-04-20 2 min read bash Learning Linux
Sometimes just one line of code can make all the difference. I will show you with example. Here is script with 2 functions. Both are writing some lines of text to a file. First function, “a” I have used the redirection to write to file. Function “b”, I have opened a file descriptor with “>” before going into the loop and use that reference for writing to the file. (This concept remains same for any scripting or programming language). Continue reading