The Friendly Coder

On software development and technology

BASH error handling

I have been spending a lot more time lately working in Linux environments, which has afforded me with an opportunity to learn more about the Bourne Again Shell and it’s scripting environment. One thing I found somewhat tedious and difficult to figure out was how to effectively do BASH error handling in shell scripts. I’ve summarized several gotchas I encountered as well as several patterns that seem to work quite well.

MSBuild Gotchas: Traversed Static Item Evaluation

If you know anything about MSBuild, you know that knowing the order of evaluation for properties, items and such is critical. But how does the order of evaluation work when chaining control to other scripts using the task (otherwise known as script traversal)? The answer may surprise you.

Batch File Gotcha: Question Mark Wildcard

Todays batch file gotcha applies equally well to DOS commands in general, but if you think you understand how basic wildcard substitution is performed you may want to read on about this subtle gotcha…

Batch File Gotchas: Command Blocks

When multiple DOS commands are to be executed together, say in a loop or in a conditional block, they are wrapped in round brackets. But this subtle gotcha has caused me many head-scratching sessions in front of my text editor…

MSBuild Gotchas: Task Batching

Look at the following two statements: <Message Text=”Value = ‘@(SourceFiles)”/> and <Message Text=”Value = ‘@(SourceFiles)” Condition=”%(SourceFiles.identity)!=””/>? If you don’t know why these two statements give different outputs then you need to read on.