script command is used to record shell sessions.It is useful for documentation, capturing and replicating issues. Simplest Implementation: Now by default, output file is ‘typescript’. We can pass any other name for output file as below.$ script myscript.log Now myscript.log would contain the output.If we examine the contents of this file, we find exactly whatContinue reading “Record shell sessions”
Category Archives: Linux
Shell Script to read csv file into Array
This is a shell script to read a csv file into array and display the contents. Using an array is preferred we can keep track of no. elements in a row.For example:echo ${row[@]} will display all the elements of array.echo ${#row[@]} will display the no. of elements in the array.Also to get the 2nd elementContinue reading “Shell Script to read csv file into Array”
Write a Service Unit on Arch Linux
A service unit describes how to manage a service or application. This includes how to start or stop the service, under which circumstances it should be automatically started, and the dependency and ordering information for related software. System Unit files are generally loaded from:/etc/systemd/system/ Below is an example of a simple service unit file: UsingContinue reading “Write a Service Unit on Arch Linux”
Simple spin animation using shell script
Below shell script will do a simple animation of rotating “pipe” (|) . We use an array called spinner, with elements : ( ‘|’ ‘/’ “–” ‘\’ ). We loop through the elements each 0.1 secs to make it look like the rotating animation.