Skip to content
Back to top

# Shell Tricks

All the Vinyl Cache programs can be invoked with the single argument `--optstring` to request their getopt() specification, which simplifies wrapper scripts:

    optstring=$(vinylfoo --optstring)

    while getopts "$optstring" opt
    do
        case $opt in
        n)
            # handle $OPTARG
            ;;
        # handle other options
        *)
            # ignore unneeded options
            ;;
        esac
    done

    vinylfoo "$@"

    # do something with the options