How to combine two or more shaders?

I know that it is possible in OpenGL to combine multiple fragment shaders after one another. Is something like this also possible in Unity?

And differently, is it also possible to import a piece of shader code into another piece of shader. For example, a small part of code that needs to be dynamically added to almost every shader. In this way, I don’t have to rewrite every default shader with diffuse/specular/bumped, but just with 2/3 lines extra.

I’m not exactly sure I understand what you are asking, but if my assumptions are correct - If it is possible in OpenGL, it should definitely be possible in Unity. You would need to employ multiple passes in order to achieve this.

For the second question, you are looking for the include tag:

#include "your_cg_include.cginc"

Also, look into UsePass

UsePass "YourShaderHere/ShaderPass"

Which will allow you to use the pass of another shader, very useful for not having to write things over again.

Using this will load the cg code from that include file into the current shader program, a very good way to create modular and reusable cg snippets!

I hope that helps!