lets say when I execute command and then grep it for a specific output.
for example: man cat|grep "Written"
This gives the name of the authors.
My problem is I want to do this via read.
here is an example of my script:
#!/bin/bash read variable #lets say input is: man cat|grep "Written" $variable
It does not seem to work. I need this to work as I am doing a larger script and this part got me stuck. Any tips are appreciated.
var=$(man cat | grep 'Written')
later you use it like:"$var"
(don't forget double quotes to avoid word splitting).eval
(orbash -c
), think hard about why you want to do this, or why you believe that you need to.