Prisijungti

bash scriptas. For sukurti katalogus paimant informacija

  • 6 Grd '11

Sveiki,

Reikia pagalbos su bash script. Yra failas YER kuriame yra 4 zodziai, reikia sukurti bash scripta kuris paimtu informacija is YER failo ir sukurti 4 folderius, naudojant For cikla. Gal kas galetu pagelbeti ? Aciu.

TechtronicMindaugas N.
  • 7 Grd '11

Tai nesaugu!

#!/bin/bash
failas="$HOME/tmp/YER"
kur="$HOME/tmp"
for foo in `cat $failas`; do
    mkdir $kur/$foo
done
  • 7 Grd '11

kazkodel jis man sukuria folderi su cat uzrasu ,o ne is failo tuos zodzius.

  • 7 Grd '11

Perrašinėdamas panaudojai ne tas kabutes - vietoj backticks `, panaudojai paprastas kabutes '.

Kad niekad nesusipainiotum tarp backticks ir paprastų kabučių savo skriptuose naudok tokią išraišką $( komanda ).

Taigi gali perrašyti šį skriptą taip:

#!/bin/bash
failas="$HOME/tmp/YER"
kur="$HOME/tmp"
for foo in $( cat $failas ); do
    mkdir $kur/$foo
done
  • 7 Grd '11

Mano variantas:

#!/bin/sh

test "" != "$1" || exit 1

for item in $(cat $1) ; do
    mkdir -p $item
done

Paleisti reikia taip:

./skripto_vardas.sh YER

Šiaip tai tokiam reikalui nereikia net skripto, užtenka tokios vienos komandos:

for d in $(cat YER) ; do mkdir -p $d ; done
  • 7 Grd '11

Aciu, abieju veikia, jo buvau tikrai blogas kabutes uzdejas.

  • 14 Lie

40 Pills For 99.00 Bloorymymn [url=https://ascialis.com/#]Cialis[/url] tisindtriery Viagra 40 Pills For 99 ordeNe <a href=https://ascialis.com/#>Cialis</a> Paileillenny Keflex Dose

  • 5 Rugs

online canadian pharmacy viagra <a href=http://canadian4pharmacy.com/>canada pharmacy</a> diet to lower blood pressure

  • 15 Rugs

toms river health department http://withoutdrprescriptions.com – viagra no prescription insurance plans [url=https://withoutdrprescriptions.com/]buy viagra online[/url] www united healthcare com

  • 16 Rugs

june carter cash online payday: http://www.loansonline1.com/# pay day [url=http://www.loansonline1.com/#]payday loans[/url] payday loans online loans

  • 16 Rugs

is viagra safe for older men le iene cialis [url=http://try4ed.com/]viagra no prescription[/url] tomar viagra antes http://try4ed.com/ vets hospital near me

  • 19 Rugs

google finance stock quotes: http://loanssl.com payday loans american first finance
loan loan republic

  • 20 Rugs

walmart price for cialis
https://www.tadalafil5walmart.com cialis walmart price

  • 25 Rugs

Whoa many of good data.
[url=https://withoutxep.com]viagra without doctor prescription[/url]
topical viagra women https://withoutxep.com viagra no prescription

<a href="http://viagrabun.com">viagra pills</a>
viagra internet zoll https://viagrabun.com/# buy viagra

Atsakyti