Can I mix Cg and GLSL ?

Hi. I wish to use this simple glsl shader for Iphone and Mac

Shader "simple_Red_Shader" 
{     
    Properties 
    {         
                
    }
    SubShader 
    { 
        Tags { "Queue" = "Geometry" }
        Pass 
            {             
                GLSLPROGRAM                          
                #ifdef VERTEX  
                void main() 
                {           
                   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
                } 
                #endif  
            
                #ifdef FRAGMENT
                void main() 
                {           
                   gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);
                } 
                #endif                          
                ENDGLSL        
            }
     } 
}

And this simple Cg shader for win - web

Shader "Simple_CG" 
{
    SubShader 
    {
        Pass 
        {
            CGPROGRAM
            // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
            #pragma exclude_renderers gles
            #include "UnityCG.cginc"
            #pragma fragment frag
            struct Cg2_Output 
            {
            
              float4 color : COLOR;
            
            };
            
            Cg2_Output frag(float4 color : COLOR)
            
            {
                Cg2_Output OUT;
                OUT.color = float4(0, 1, 0, 1); // RGBA green
                return OUT;
            }
            
            ENDCG
        }
    } 
}

I currently use

Shader "simple_Red_Shader" 
{     
    Properties 
    {         
                
    }
    SubShader 
    { 
        Tags { "Queue" = "Geometry" }
        Pass 
            {             
                GLSLPROGRAM                          
                #ifdef VERTEX  
                void main() 
                {           
                   gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
                } 
                #endif  
            
                #ifdef FRAGMENT
                void main() 
                {           
                   gl_FragColor = vec4 (1.0, 0.0, 0.0, 1.0);
                } 
                #endif                          
                ENDGLSL        
            }
     } 
Fallback "Simple_CG"  }

Is there a better way to do this ?

You can put both subshaders into the same shader. Unity will use the first subshader that works on a given platform.

Thanks, it works fine !