Skip to content

Tag: shell

Force a shell script to fflush

I was wondering if it was possible to tell bash that all calls to echo or printf should be followed up by a subsequent call to fflush() on stdout/stderr respectively? A quick and dirty solution would be to write my own printf implementation that did this and use it in lieu of either built in, but it occurred …

BASH: how to perform arithmetic on numbers in a pipe

I am getting a stream of numbers in a pipe, and would like to perform some operations before passing them on to the next section, but I’m a little lost about how I would go about it without breaking the pipe. for example Would you have any ideas on how to make something like this work? The actual operat…

Parsing result of Diff in Shell Script

I want to compare two files and see if they are the same or not in my shell script, my way is: Basically, if they are the same ${diff_output} should contain nothing and the above test would evaluate to true. But when I run my script, it says [: too many arguments On the if [….] line. Any ideas? Answer