Thanks, unspawn! I think i'm headed in the right direction.
To answer your question, i can't use pgrep because i don't know if the input is going to be a user, or a process, or...? It could be anything!
But the rest of your response makes perfect sense, and replacing the spaces with a | is a great idea, thanks! I'm having some problems getting grep or egrep to take a search in the form (this|that|someother), though. It looks like it's been deprecated?
UPDATE: Okay, i got it working using:
Fixing other little things here and there, will get back to you when i'm finished
EDIT: D'oh. Okay, so i changed that to
...because passing it as
egrep '${z}' passes ${z} instead of this|that.
Also, i ran into a problem where the first blank character was being converted to a pipe as well, and found the following code to fix that:
Code:
var="${var#"${var%%[![:space:]]*}"}"
Thanks again!!