Hairy feature of the week is the new ability in guestfish ≥ 1.9.5 to use shell script inline to generate guestfish commands. This simple example adapted from the manual demonstrates how to touch files
><fs> <! for n in `seq 1 100`; do echo touch /foo.$n; done
How this works is it passes everything after the <! to the shell (actually to popen(3)), it then reads what this prints out:
touch /foo.1 touch /foo.2 etc.
and it executes them as guestfish commands.
You can use this to emulate variables in guestfish (although this is probably not very advisable).
><fs> inspect-get-roots | head -1 > /tmp/root ><fs> !cat /tmp/root /dev/vg_f13x64/lv_root ><fs> <! echo inspect-get-product-name $(</tmp/root) Fedora release 14 (Laughlin)
The “variable” here is stored in the file
/tmp/root. This is all obviously rather hairy and at some point we may add proper variables to guestfish.