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
    cat junk2

$ . ./test: test2
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: ]

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