I want to know how to pipe t开发者_开发问答ext from a cat or anything so i can use it as a variable.
If using bash:
FOO=$(cat foo)
if using bash, no need cat
var=$(<file)
i hope i understood you.
u can pipe to stdin with FIRST_COMMAND | SECOND_COMMAND.
if you want to use really variable u should write
$var=`COMMAND`
Set the variable to the result of a command using '
characters, like this:
$ var='cat foo'
This approach works in most shells.
精彩评论