Stranica: 2/3.
Re: Bash rekurzivno putovanje direktorijima
Postano: 24 svi 2013, 11:07
Postao/la 4ndY
demaxfa je napisao/la:cim sam copy pastao i pokrenu ./ren izbacio mi je ovu grešku nakon toga sam probao zamjeniti " sa ' i ' sa " i urznim kombinacijam ali je svaki put javljao drug grešku
1. Imaš li #!/bin/bash na početku skripte?
2. Jesi li stavio +x (exec) ovlasti nad fajlom (chmod +x ren)?
Ja sam sad probao preko skripte i meni radi...
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 10:15
Postao/la demaxfa
1.da
2.da
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 10:25
Postao/la tomog999
Stavi kopiju skripte sa izmjenama ovdje,
nekak je teško debagirat nešto što ne vidiš, svaki vjernik ti to može potvrditi

Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 15:28
Postao/la 4ndY
Probaj dodati -print0 kod find-a i -0 kod prvog xargs-a... Iako ne znam hoće li ti to pomoći. Probaj također debugirati skriptu tako da je prvo pokreneš do prvog "|" (pajpa), pa onda do drugog.
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 16:15
Postao/la demaxfa
Kod: Označi sve
#!/bin/bash
# renames.sh
# basic file renamer
find . -type f -name "*.mhtml" -o -type f -name "*.mht" | xargs -I item sh -c '{ echo item; echo item | sed "s/[:?|]//g"; }' | xargs -n2 mv
nakonon ponovnog copy pastea javlja drugu grešku valjda nešto nisam dobro pastao.
./ren
xargs: unmatched jednostruki quote; by default quotes are special to xargs unless you use the -0 option
sh: 1: sh: 1: Temash.html.mht: not foundAMD’s: not found
sh: 1: sh: 1: AMD’s: not foundTemash.html.mht: not found
mv: missing file operand
Try `mv --help' for more information.
darko@debian:~/Web$
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 16:35
Postao/la demaxfa
Probao sam redirectati output od ./ren > debug.txt ali neće ispistti dump u file???
Darko
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 17:27
Postao/la demaxfa
Cuj andi koristis li irc ili skype? skyp mi je darmati3.
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 17:30
Postao/la demaxfa
Kod: Označi sve
./ren > debug.txt
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
sh: 1: Linux: not found
mv: target `«' is not a directory
mv: target `a' is not a directory
mv: target `Information' is not a directory
mv: sh: 1: Syntax error: "(" unexpected (expecting "}")
target `Technical' is not a directory
mv: target `on' is not a directory
mv: target `a' is not a directory
mv: target `reviews' is not a directory
mv: target `Ars' is not a directory
mv: target `history' is not a directory
mv: target `Ars' is not a directory
mv: target `5' is not a directory
mv: target `of' is not a directory
mv: target `Ars' is not a directory
mv: target `3' is not a directory
mv: target `history' is not a directory
mv: target `1' is not a directory
mv: target `part' is not a directory
mv: target `Amige/Shadow' is not a directory
mv: target `2' is not a directory
mv: target `an' is not a directory
mv: target `history' is not a directory
mv: target `Ars' is not a directory
mv: target `4' is not a directory
mv: target `of' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `postlaunch' is not a directory
mv: target `the' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `stopping' is not a directory
mv: target `Ars' is not a directory
mv: target `alive!' is not a directory
mv: target `Amige/A' is not a directory
mv: target `4' is not a directory
mv: target `part' is not a directory
sh: 1: Ars: not found
mv: sh: 1: Ars: not found
target `history' is not a directory
mv: target `Ars' is not a directory
mv: target `4' is not a directory
mv: target `of' is not a directory
mv: sh: 1: Ars: not found
target `./Razno/Povijest' is not a directory
sh: 1: Ars: not found
mv: target `1' is not a directory
mv: target `part' is not a directory
mv: target `Amige/A' is not a directory
mv: target `prototype' is not a directory
mv: target `AmigaOS' is not a directory
mv: target `reviews' is not a directory
mv: target `of' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `Enter' is not a directory
mv: target `the' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `stopping' is not a directory
mv: target `of' is not a directory
mv: target `3' is not a directory
mv: target `part' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `birth' is not a directory
mv: target `of' is not a directory
mv: target `1' is not a directory
mv: target `part' is not a directory
mv: target `of' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `retrospective' is not a directory
mv: target `Beast' is not a directory
mv: target `Amige/A' is not a directory
mv: target `bleeding' is not a directory
mv: target `Amiga,' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `Ars' is not a directory
mv: target `Amiga' is not a directory
mv: target `the' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `Game' is not a directory
mv: target `the' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `on!' is not a directory
mv: target `Amiga,' is not a directory
mv: target `Amige/It’s' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `Technica.html.mht' is not a directory
mv: target `Genesis' is not a directory
mv: target `Amiga,' is not a directory
mv: target `history' is not a directory
mv: target `3' is not a directory
mv: target `part' is not a directory
mv: target `Amige/A' is not a directory
mv: target `scene' is not a directory
mv: target `Amiga,' is not a directory
mv: target `./Razno/Povijest' is not a directory
mv: target `retrospective' is not a directory
mv: target `Beast' is not a directory
mv: target `Amige/A' is not a directory
mv: target `3' is not a directory
mv: target `part' is not a directory
mv: target `history' is not a directory
mv: target `4' is not a directory
mv: target `part' is not a directory
mv: target `Amige/A' is not a directory
mv: target `4' is not a directory
mv: target `part' is not a directory
mv: target `history' is not a directory
mv: target `Ars' is not a directory
mv: target `7' is not a directory
mv: target `Ars' is not a directory
mv: target `alive!' is not a directory
mv: target `Amige/A' is not a directory
mv: target `Ars' is not a directory
mv: target `1' is not a directory
mv: target `Everything' is not a directory
mv: target `Place' is not a directory
mv: target `Medium.html.mht' is not a directory
darko@debian:~/WebReaper$
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 19:46
Postao/la tomog999
Koliko vidim ovaj one liner ima problem sa fajlovima koji imaju pipe simbol "|" u nazivu.
Re: Bash rekurzivno putovanje direktorijima
Postano: 25 svi 2013, 21:30
Postao/la tomog999
Par navodnika riješilo stvar.
Kod: Označi sve
#!/bin/bash
find . -type f -name "*.mhtml" -o -type f -name "*.mht" | xargs -t -n 10 -I item sh -c '{ echo "item"; echo "item" | sed "s/[:?\|]//g"; }'| xargs -n2 mv
E da, ako hoćeš izbaciti verbosity iz xargs komande onda makni "-t" opciju.