i want to ask if i can execute command within command ...or use the output of the previous command as the input of the followed command : command x then command y in command y i want use output of command x
You can do something like;
x=$(grep $(dirname "$path") file)
here dirname "$path"
will run first and its result will be substituted and then grep will run, searching for the result of dirname
in the file
What exactly are you trying to do? It's not clear from the commands you are executing. Perhaps if you describe what you're looking for we can point you in the right direction. If you want to execute a command over a range of file (or directory) names returned by the "find" command, Colin is correct, you need to look at the "-exec" option of "find". If you're looking to execute a command over a bunch of arguments listed in a file or coming from stdin, you need to check out the "xargs" commands. If you want to put the output of a single command on to the command line of another command, then using "$(command)" (or 'command' [replace the ' with a backquote]) will do the job. There's a lot of ways to do this, but without knowing what it is you're trying it's hard to be more helpful.