There was a high rate of attrition once the soldiers went "Over the top" and living in the trenches had a lot of disease, as well as the PTSD caused by the constant barrages. If I took a camera to film within the trenches, just how much danger would I be in? Prior to the battle of the Somme, the allies pounded the German lines, according to the IWM site 7 days, 1.5 million shells, and the Germans still had an effective defense. So if I was just in the allied trench, for a few days, would I have a high chance of survival?
I can't give you an exact number, obviously, but I've answered questions similar to this here and here. You might also be interested in this answer about what the fighting on the Western Front was like before the trenches (spoiler: it was a bloody mess). But the short answer to your question is yes: trenches were quite effective at sheltering troops from shell fire; this was their purpose.
The experience also differs between armies. Since the Germans adopted the strategic defensive in the West in November 1914, they devoted far greater resources to trench and shelter construction than did the French and British. The French and British still dug extensive trench networks, but they were only as good as they needed to be. Defenses were always seen as being temporary; there wasn't much point in constructing concrete pillboxes or comfortable dugouts if, in theory, you were going to be leaving them and attacking the Germans all the time. Again, I don't have figures at my fingertips, but for this reason I would suspect that casualties as a result of errant shellfire would be lower in the German army than in the French or British armies.
It's worth pointing out that even in the earliest days of static trench warfare, a comparatively rudimentary trench (well, rudimentary by 1917 standards) was completely sufficient to protect against most forms of shellfire. At the River Aisne in September 1914, for example, several officers in the 2/Grenadier Guards reported that their trench lines, positioned on the reverse slope of the valley, were quite effective despite only having been dug a week or so prior (see Craster, Fifteen Rounds a Minute). Once shelter trenches equipped with overhead cover and extensive subterranean dugouts came into play, trench lines were quite safe. Armies also embraced the practice of holding soldiers in better cover and thinly manning the front line during bombardments. This also minimized casualties, as General Bulfin notes during a relatively heavy German bombardment on the Aisne in September 1914 (Bulfin Diary, WO/95 series, The National Archives).
A soldier would be more exposed to shellfire during an enemy infantry attack, thereby lowering chances for survival. During an infantry attack, more riflemen would have to man the front-line firing trenches to defend against impending infantry advances. Fire trenches were not as good at sheltering troops as dugouts or cover trenches (because they lacked overhead cover, which got in the way of shooting at your enemy). The rolling barrage exploited this; it kept up artillery fire as long as possible while the infantry advanced, forcing the enemy to commit its infantry to the firing trenches and consequently increasing the number of casualties resulting from shellfire. The early stages of the Somme battle show the opposite: the lengthy preparatory barrage failed to neutralize the German defenders, who were free to man the fire trenches unmolested while the British pushed forward their infantry. German application of defense-in-depth, which kept even more soldiers out of exposed, forward positions made defensive trench lines even safer.