I am trying to execute variable concated from other variables and strings as command in shell-script. could you help me?
inside file (executable shell-script):
#!/bin/bash
var1=aaa
var2=bbb
var3=ccc
var=$var1$var2' '$var3' > '$var3'.out &'
echo $var
desired output: aaabbb ccc > ccc.out &
aaabbb ccc > ccc.out & ...execute as command???
echo ...
eval ...
???
How can I write it in shell-script for output of echo $var to be executed as command?
When I run this command (aaabbb ccc > ccc.out &) "manualy" in terminal it works fine, but when I use it as variable in shell-script and execute it, then I do get an error - command not found.
I had tried many combinations with/without quotes, but I have had no luck. Also tried eval and echo.