Question: I'd like to split the following GST command into two halves using shell script.

`/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink: caps = application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0KAHukBQHpCAAAH0AAB1MAI\\,aM48gA\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075`

The split has to occur at caps =
The two new lines should be stored in two variables $var1 and $var2

$var1 should contain
`/GstPipeline:pipeline0/GstUDPSink:udpsink0.GstPad:sink:`

And $var2 should contain
`application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, sprop-parameter-sets=(string)\"Z0KAHukBQHpCAAAH0AAB1MAI\\,aM48gA\\=\\=\", payload=(int)96, ssrc=(uint)2416890621, clock-base=(uint)518578781, seqnum-base=(uint)24075`

Remember there are two backslashes in the input string. So doing an echo will give only one backslash.

Answer: 
There is no good way to do what you want. You can get close with `Debug.Trace` but I don't recommend that while learning because of Haskell's non standard evaluation order. Haskell does not work by sequentially setting the value of "variables" in the way languages like C and C++ do. Because it is lazy, Haskell expressions are evaluated in an order that depends on use, so the incremental value thing does not really work. 

Haskell is an *expression oriented language*. Use that to your advantage:

1. Write short functions. It is easier to see what each function does this way. Most functions should be one line per equation, and real "one liners" should be common.
2. Use the REPL. You should constantly be experimenting with your code in GHCi
3. Use the type system. Haskell's type system is orders of magnitude more useful than the type systems in most imperative languages. Types document intent in a machine checked way. You can't expect to understand code without understanding the types. When writing code, once you get the types right you are most of the way done.

Combine the above suggestions. You can get the type for an expression in GHCi with `:t`.
First, you can debug your functions by loading them into `ghci` and playing with them there. 

Then, you can use `trace` from [`Debug.Trace`](http://hackage.haskell.org/packages/archive/base/latest/doc/html/Debug-Trace.html) to print a string when an expression is evaluated. However be aware that since Haskell uses lazy evaluation, in most cases an expression will be evaluated at a different time than you'd expect. See also [Wikibooks](http://en.wikibooks.org/wiki/Haskell/Debugging) and [Haskell wiki](http://www.haskell.org/haskellwiki/Debugging#Printf_and_friends). (Internally `trace` uses unsafe calls that allow it to print output even within pure code. Normally you're not supposed to use them, but in this particular case it is OK.)