bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Nontrivial Quoting Problem


From: dancy
Subject: Nontrivial Quoting Problem
Date: Tue, 1 Jul 2003 19:59:10 +0300 (EEST)

    I have 2 directories: `fine' and `big trouble'.
1) I do
        ls fine 'big trouble'
Fine.
2) Now I set a variable
        my_dir='big trouble'
and I do
        ls fine "$my_dir"
Still fine.
3) I need to set one more variable
        what="fine \"$my_dir\""
and I try to do
        ls $what
but it DOESN'T WORK!
    I tried every form of quoting I could imagine, but in vain. PLEASE HELP!!!

P.S.1) I've found I can do
        set -- fine "$my_dir" ; ls "$@"
but it is very ugly and I don't use my variable _what_.(I've tried what="$@" 
and such, but ls $what still doesn't work. So frustrating!)
P.S.2) I've also found I can do
        what=(fine "$my_dir") ; ls "${what[@]}"
That's better, but is it the only way? Do I HAVE TO use an array?

BASH_VERSION=$'2.05.0(1)'




reply via email to

[Prev in Thread] Current Thread [Next in Thread]