I'm still learning unix and I need to know if there is a way to perform the following actions.
Is there any way I can echo a read variable, and in the process, dissect it letter by letter, and assign specific commands to every letter? For example, if the regular echoed output would be "cat", how would I make c, a, and t execute different commands? Is this possible?
I have attempted various methods using fold to split the letters up into their own lines. I just need a way to make the letters equal a command.
It would pretty much look like this:
read variable
echo $variable | fold -w 1
Am I on the right track?
command1;command2;command3
. Piping output tofold
won't run commands no matter what, so it's hard to tell what problem you're really trying to solve here. Could you edit your question to add more detail? – Wildcard Apr 03 '16 at 07:28