Hello,
I am looking for an easy way to splice an array (full of commands). It is an array full of commands and pipes for the bash shell
Example, if I pass an array like the following into a function
array[0] = "ls"
array[1] = "-a"
array[2] = "|"
array[3] = "grep c"
array[4] = "|"
array[5] = "more"
What I want to do is extract array[0] and array[1], and execute them into a child process etc (open a pipe and use dup2 etc), continue until I find a pipe and extract array[3], and continue onwards.
Which string functions should I be using or simply an easier method. I have never been that good with C style strings and arrays.
Typically, array[0] will always be a command