shell scripting

scripting – performance improvement with file open


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 …

Fix weird flux menu


Some distro’s just add all the items under single menu and thus the menu itself becomes unusable because of the number of items in the submenu and this I did not like and hence ceated this simply …

change the output format for time command


If you are doing some scripting and using ‘time’ command, then you know sometimes it becomes difficult to capture the output as the output would be something like this: : amit ; time ls real 0m0.002s …

Generate random string for various use case


Some times I need random string, for example to use as email seperator or to use in some API. One way is to use tools like /dev/[u]random or od and other such. But they seem cubersome after I figured …

bash – refer the first parameter from last command quickly


To refer to first parameter from the last command quickly, you can use !^ Note: This can also be referred as “!!:1“

This website uses cookies to ensure you get the best experience on our website. Learn more Got it