Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: convolutions



On 11/07/2015 01:32 AM, Bart Schaefer wrote:

That will fail with "bad substitution" for anything more than a single
word in the file "junk1".

test2 ()
{
    rm junk2
    cat junk1
    echo "$(eval echo "\${$(cat junk1)}")" >! junk2
    echo
    cat junk2
}

$ . ./test: test2
12345678-10-345678-20-345678-30-345678-40-345678-50-345678-60-345678-70-345678-80-345678-90-345678-100
let me not to the marriage${red}of true minds${yellow} admit impediments.${reset}
        Love    is    not    love which    alters${green} when ${reset}

[ in glorious color: ]

10-345678-20-345678-30-345678-40-345678-50-345678-60-345678-70-345678-80-345678-90-345678-100
let me not to the marriageof true minds admit impediments.
        Love    is    not    love which    alters when


The file is for a deliberate torture test of color handling and tab expansion, so pardon the ugliness, it's the point of it. But it's working here, tho the first part of my 'measuring string' is cut off for some reason. I don't like this, I hate it, it's dangerous. Don't tell me it sux, I know it sux. But I would like some way of performing expansions inside a file without any gottchas. Surely that's simple at least to verbalize:

    $ cat in_file | expand_all_parameters > out_file




Messages sorted by: Reverse Date, Date, Thread, Author