Shell Command substitution with variable concatenation

Hey there,
This post is about doing something perhaps the "hard way" as an exercise in furthering my knowledge of /bin/sh scripting. Below is just an example, simplified for brevity.
Code:
#!/bin/sh
ZFS=/sbin/zfs
# Command subst example
ZFSL="/sbin/zfs list -d 1 -H -o snapshot:type,name -S creation -t snapshot"
DATASET="zpool/home"

test()  {
    # Now list the snapshots with name $DATASET
    snap_names=$($ZFSL $DATASET)  # Problem Area number 1
    # Maybe it should be: snap_list() ($ZFSL" "$DATASET"; };

    $ Feed List Items       # Problem Area Number 2
    while read -r snap_type snap_name; do
        echo "$snap_name"

    done

As I stated, This is simplified for relevant problem areas.
 
Back
Top