On 23/02/14 07:39, berenger.morel@neutralite.org wrote:
Le 20.02.2014 02:15, Scott Ferguson a écrit :
On 19/02/14 23:32, berenger.morel@neutralite.org wrote:
Le 19.02.2014 10:53, Scott Ferguson a écrit :
Just read your last post before sending this, so this may no
longer be relevant... I don't know that you need to quote the
variables. I use coloured bash
coloured *editor* i.e. nano, vi/emac, dex[*1] or Kwrite is what I
meant to write. If anyone knows of a way to colourise the syntax in
xterm (especially 'fc' temp) I'd be *very* interested.
I think I did not read correctly when I replied to you.
No. The mistake was mine (I didn't write "editor" originally).
I also use syntactic coloration in my editors, I'm a programmer
after
all. And vim manages it correctly enough... Still, it did not helped
me with *that* pebcak. The only things colored in my shell is not
bash, btw, only the prompt... indeed, a colored shell would be very,
very powerful.
Darac (Paul?) made a suggestion about that - there is also fish.
<snipped>
but for a reason I can not understand, echo did not displayed
them.
I'm not sure if you mean echo as in your example:-
for i in *.zip;
do
artiste=`echo $i|cut -f1 -d-|sed -e 's/^ *//g' -e 's/ *$//g'`
album=`echo $i|cut -f2 -d-|sed -e 's/^ *//g' -e 's/ *$//g'`
mkdir "$artiste/$album" -p
7z x \"$i\" -o\"$artiste/$album\" || rmdir "$artiste/$album" -p
echo 7z x \"$i\" -o\"$artiste/$album\"
done
If so, perhaps it's the way you were using echo? It displays the
string
- including the spaces, but when you use the string with 7z it's
working
with only working with the first word/character before the space -
because you're escaping the last " in each string.
So if artiste is "Frank Zappa" and album is "Weasels Rip My Flesh"
then
those variables will display fine with echo, but because you were
escaping the parenthesis 7z is trying to work with Frank, not "Frank
Zappa". And if the artiste or album contains a minus character....
Note also - if you want to echo escape characters you need to use the
-e
switch, or just avoid them altogether - I'd, cautiously (I haven't
tested it, and I'd prefer more error checking) suggest this
variation:-
for i in *.zip;
do
artiste=`echo $i|cut -f1 -d-|sed -e 's/^ *//g' -e 's/ *$//g'`
album=`echo $i|cut -f2 -d-|sed -e 's/^ *//g' -e 's/ *$//g'`
mkdir -p "$artiste/$album"
7z x "$i" -o "$artiste/$album" || rmdir "$artiste/$album"
echo "7z x $i -o $artiste/$album"
done
<snipped>
Kind regards