[gull] Truc et astuces: Jouons avec ``eval'' et bash

Félix Hauri felix at f-hauri.ch
Fri Oct 5 21:33:57 CEST 2007


Sans commentaires, juste un saut de ligne avant les commandes.

$ echo $str


$ str=$(eval echo -e $(printf '\\\\%o,' $(seq 65 90)) |
        sed 's/^/{/;s/,$/}/')

$ echo $str
{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z}

$ eval echo $str
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

$ eval "printf '%s\n' $str\ $str\ $str" | wc
  17576   52728  105456

$ echo 'a=26^3;a;a*3;a*6' | bc -l | xargs printf "%7d %7d %7d\n"
  17576   52728  105456

$ eval "printf '%s\n' $str\ $str\ $str\ $str"

-- 
 Félix Hauri  -  <felix at f-hauri.ch>  -  http://www.f-hauri.ch



More information about the gull mailing list