Category Archives: Shell Script

echo and backslash-escaped caracters / new lines: how to write portable scripts ?

While writing shell scripts you are using a lot of ‘echo’ but did you think about portability of this simple statement ? Can you say what will be diplayed, without testing, on your shell, the following tests : echo \n … Continue reading

Posted in Shell Script | Leave a comment

[BASHISM] How to generate random number without $RANDOM ?

There is a common bashism, that is to use $RANDOM. Typically you’ll have to remove bashism while rewriting your scripts for dash or sh. There is a lot of solutions to generate random numbers in many different ways, but I’m … Continue reading

Posted in Shell Script | 3 Comments