Posts tagged as code

So after fighting with zsh for a bit, it seems there is never, ever, a 0 element in zsh arrays. All arrays start populating at element 1 i.e $array[1] Here is some example code to help ya populate and pilfer through an array of elements if its g…

So I needed to take in a pasted stdin that was multiple lines. Using just read or any of the flags it provides don’t give a nice clean way to do this. However, using cat and sed, you can provide a few nice ways to allow a user to end the input s…

In one of my scripts, I wanted to create a log file that was dynamic based on how the script was running. For example, if the script was doing something like waiting on another script or generated an error for whatever reason, I wanted the log f…

Yeah. ccze. is awesome! I really wanted to use it across my systems and with all applicable commands like head, tail, cat, etc.. So I wrote a zsh function to check if the command exists and utilize it. This was kind of a pain because of the cor…