pstree needs to check if it writes the terminal, and if it requests the terminal for its column width, and then limits the output accordingly. You can do something like this:
WIDTH=`stty size | cut -d ' ' -f 2` # Get terminal character width pstree | grep MDSImporte | cut -c 1-${WIDTH} # Chop output after WIDTH chars
Other utilities (such as less ) may do this for you, but may have other side effects (for example, asking you to press the space bar after each page of output).
Also...
If you ask how you can determine if a script is writing to a terminal, file or channel, you can do this:
[ -t 1 ] && WIDTH=`stty size | cut -d ' ' -f 2` pstree | grep MDSImporte | cut -c 1-${WIDTH}
This will set WIDTH if and only if standard output is a terminal. If so, it will limit the output to WIDTH characters (by calling cut -c 1-80 , say). If this is not the case, this will not limit the output (because cut -c 1- does nothing).
Rob davis
source share