Grab results of GRUB's find command into a shell script variable
hi,
I am running the following command from my bash shell script: Code:
#!/bin/bash Code:
debian:~#grub --no-floppy Thanks |
To capture the output of a program, just use backticks (or an equivalent syntax), like this:
Code:
var=$(grub whatever) |
Quote:
Thanks |
I think this should work:
Code:
#!/bin/bash Code:
var=$(echo find /sbin/init | /usr/sbin/grub --no-floppy --batch | grep -o 'hd[0-9]*') |
Quote:
The code worked just fine. Thanks! |
Be prepared for the possibility that your variable may have more than one value in it when you go to use it.
|
Quote:
|
All times are GMT -5. The time now is 02:23 PM. |