Results 1 to 4 of 4
I've been able to get the right output that I need from sed, but how can I execute the string that sed actually outputs?...
- 08-02-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 9
[SOLVED] executing sed's output
I've been able to get the right output that I need from sed, but how can I execute the string that sed actually outputs?
- 08-02-2010 #2
If you use the "`" apostrophes, the output of the command will be executed.
You can also use xargs.Debian GNU/Linux -- You know you want it.
- 08-02-2010 #3
The 'apostrophes', usually referred to as 'backticks' are used by the shell to transform standard output into a commandline argument. Backticks have been deprecated in favor of the the $(command) format. Bash in most distros now supports this format.
Example:
The first command simply emits the string "ls -la", while the second command actually invokes that command. Not an efficient way to use the feature, but does demonstrate the principle.Code:echo "ls -la" $(echo ls -la)
As GNU-Fan correctly points out, xargs can also be used, and is probably a better option if the result of your sed command can be a very long list of arguments.
man xargs
--- rod.Stuff happens. Then stays happened.
- 08-02-2010 #4Just Joined!
- Join Date
- Apr 2010
- Posts
- 9
thanks for the xargs suggestion; worked great!


