2016-03-29 3 views
2

Ich habe versucht, einen einfachen Bash-Skript zu schreiben, um eine Reihe von zufälligen Zeichen zu drucken:Weird Bash Script Anomalie - was ist Anaconda-ks?

for i in {1..100000} 
do 
    echo -n $(printf \\$(printf '%03o' $(((RANDOM % 220) + 35)))) 
done 

Es ist, dass alles in Ordnung, aber aus unerfindlichen Gründen zeigt eine Reihe von nicht zufälligem Charakter up:

DU▒▒2D @ I▒▒▒lb; ▒.lO▒c▒˕ # m ~ < ▒ڃ▒ wp▒▒] ▒2▒US 栃y▒)▒▒|▒ߎD▒▒l▒8▒T▒℘6▒wh;▒▒7▒h▒▒ωӕ▒$▒йa▒▒▒▒깅-▒+▒1▒0ıC▒▒▒j1▒▒P.h=fm;▒▒6;;▒▒▒▒kL(%<▒▒o▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒▒5y#▒▒ΖsbA1vi_▒▒b▒▒ظ▒>▒▒k۹▒Ysɂ▒▒▒(▒▒▒G▒Դ▒▒cՋ▒=▒I▒ڰ벫▒l▒P▒▒KԽ▒▒lk▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒-▒ÇR▒▒▒C▒▒+w▒M▒{@س▒▒Dž▒j'q▒n'▒Tp▒▒lh▒▒.▒▒▒▒▒▒▒▒c▒N▒ܳ▒j▒▒▒▒▒▒[email protected]=▒j▒$h▒U▒▒&▒3▒/▒+W▒▒۠^▒▒N)▒oz▒▒▒▒1}΃▒▒▒B4▒▒▒/U▒▒▒▒~▒:▒▒▒▒▒'▒▒.|▒pߺ▒▒+▒c▒▒▒Iɔ▒▒▒▒▒ϞTm&▒▒<Bo&▒т▒▒VH▒2m▒▒;▒O'▒▒؜▒⊞q▒Ǧ▒▒▒O▒▒▒▒틈▒▒▒$ྕ▒▒ф▒ַ▒▒n<6▒▒▒[email protected]▒▒▒)[▒▒y1'▒n▒UзkB'▒▒]z&u8▒▒D▒▒7_▒▒|\▒▒eEy▒2ʉؕF▒▒zٹ▒)X▒▒▒?▒▒h▒▒l▒▒0▒▒L▒R:▒▒▒X▒▒▒wz▒▒6▒/▒oTڣ3d\n▒7iX \ ▒O9> ot▒K▒▒▒▒▒ (< ▒▒▒▒ ▒▒b▒▒;▒l▒▒P▒▒<6▒▒▒▒▒▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒▒r▒>J+ (▒Ч▒) 7Yq {el▒▒▒H▒Œ▒t▒gtqanaconda-ks.cfg Desktop-Dokumente Downloads install.log install.l og.syslog Musik Bilder Public Vorlagen timesynch.err timesynch.log timesynch.sh Videos8▒Dz▒A▒y▒0C▒D▒▒▒V▒▒8▒U▒ ~ U▒L▒▒▒h▒} [ ▒ < ~ ▒▒▒ {▒> Gf^▒% d▒▒▒▒▒tq▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒▒▒▒>D▒▒▒▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videok▒r▒&X▒▒▒x▒%▒▒-OՈT▒�D4▒N▒▒▒Q[x▒▒▒▒^▒;▒▒%▒▒▒m~▒▒U▒▒▒▒▒▒Wi▒▒mY▒▒▒o▒▒7W▒e▒▒E▒▒▒+▒ʥ▒▒N▒▒▒:▒▒▒▒Ԙ▒Bғ▒%[C▒▒@x▒Os▒y▒▒▒▒K)A]▒▒¹[.▒0▒▒▒▒1▒T▒▒r#I[Z▒▒▒x▒@▒▒Z▒▒▒W▒?▒rI▒▒▒\▒▒▒,▒▒▒?▒H▒▒+x▒Dm▒π▒>▒_y_H▒▒▒霰J▒▒u▒▒▒▒a▒▒2▒Zc&▒▒▒<▒▒T[쏕▒▒}ʟ▒H½▒r▒Xf▒▒▒Ppq▒U▒▒0▒▒Ҫ▒▒LBy'1ߟ▒▒▒▒anaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒/▒HE▒'▒'▒~▒_¯k▒^▒ܗm▒▒▒▒kj▒▒$▒▒[6▒▒)▒▒▒кb▒▒▒yM{&▒B▒NQv▒▒L▒▒▒Sw▒▒▒j3▒5ǥs▒Rk▒ʓZ▒▒k▒▒banaconda-ks.cfg Desktop Documents Downloads install.log install.log.syslog Music Pictures Public Templates timesynch.err timesynch.log timesynch.sh Videos▒▒t ▒/▒▒-ݯ▒ P.▒-, K▒▒▒▒hAn▒▒▒▒ [▒3] WJ▒▒▒ # ▒ (▒▒Z % ▒ + ▒ճ▒▒ T▒, ▒▒▒Ë▒ ށ ӈ▒▒▒j▒▒ԇ▒-? ▒? # ▒CHi▒▒4▒xz▒ {c▒▒▒ = ▒gsM] ▒▒▒_b▒t▒▒5J▒oJ & W▒c▒Ħ▒Gd▒ # ▒ [/ WR5▒v▒▒ | Jd▒/▒Y▒ d:▒6▒▒}▒▒|g^▒i▒u240b▒▒▒[▒▒A▒p5▒▒Z▒Pr}Ъ▒▒▒▒ғ▒&_b▒▒▒}M▒▒u▒P▒/▒:▒g▒׷▒ta V ▒9▒▒w\▒▒XS▒▒S▒▒ ▒▒▒▒▒▒▒Q▒, Q▒U'▒▒▒▒▒XgX▒▒B▒O▒▒▒▒l▒^▒l_U▒▒U> ▒▒ ▒7X▒) Ԓ`r▒20▒▒ 'ۇ▒% ▒-▒▒7 ~ ▒ anaconda-ks.cfg Desktop-Dokumente Downloads install.log install.log.syslog Musik Bilder Öffentliche Vorlagen timesynch.err timesynch.log timesynch.sh Videos⟯▒P▒t} | >V> ▒mV▒9▒▒▒▒Danaconda-ks.cfg Desktop-Dokumente Downloads install.log install.log.syslog Musik Bilder Öffentliche Vorlagen timesynch.err timesynch. log timesynch.sh Videos▒k▒k▒▒▒▒ҋ> ▒S: Sb▒Ȣ▒B▒n▒▒ @ & ▒u▒▒▒▒▒˪Oz▒H▒ ڳ N▒ (^ ▒Fl61▒▒, ▒▒i▒ = ▒E▒1ͳ▒bL- OC▒▒▒, VgI▒▒▒Y▒ & ▒o▒ IaIqp▒t▒▒twJ▒C8 {▒▒T▒o▒ ۺ▒▒ Mx▒g▒Rpm▒Qu▒▒▒▒49 \ = ▒^

Also, meine Frage ist, was ist anaconda- ks, und wie und warum zeigt es sich in der Ausgabe, mit all den anderen Sachen?

+0

Sieht aus, als ob Sie es irgendwie schaffen, 'ls' in Ihrem Home-Verzeichnis nach dem Aussehen auszuführen. 'anaconda-ks.cfg' lebt dort vielleicht als versteckte Datei' .anaconda-ks.cfg' – neric

Antwort

1

Jedes Mal, wenn Ihre nicht-quoted Befehlsersetzung einen * erzeugt, erweitert die Shell es als ein Muster, das mit jeder Datei in Ihrem aktuellen Verzeichnis übereinstimmt. Die einfache Lösung ist es zu zitieren.

for i in {1..100000} 
do 
    echo -n "$(printf \\$(printf '%03o' $(((RANDOM % 220) + 35))))" 
done 

Das besagt, dass es nicht notwendig ist, die Standardausgabe eines Befehls zu erfassen, einfach um es wieder auszugeben.

for i in {1..100000} 
do 
    printf \\$(printf '%03o' $(((RANDOM % 220) + 35))) 
done 
+0

Vielen Dank, das wars. TIL. – RRichi