Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Sussman attacks

Name: Anonymous 2012-11-21 14:35

I need help with creating a bash script
It's supposed to save a file name (minus the extension, let's say extension is .eri) to a variable, from the directory (directory is full of .eri files of different names) and then save it as <filename>.png to another folder.
There's about 100 .eri files and the converting is handled by the external application, but it's made horribly and it doesn't support wildcards correctly.

converter ~user/vnimages/<filename>.eri ~user/hentaipics/<filename>.png

Wild cards are correcly handled by the source files (so that [..]vnimage/*.eri works, but [..]*.png doesn't and it just saves all the files as *.png, overwriting them all.

something along
converter ~user/vnimages/$filenameminusextension.eri ~user/hentaipics/$filenameminusextension.png
in a loop could work, but I have no idea how to do that.
Help.

Name: Anonymous 2012-11-21 14:45

for i in vnimages/*.eri; do converter $i hentaipics/`basename $i`.png; done

Untested

Name: Anonymous 2012-11-21 14:50

gooks stop plz

Name: Anonymous 2012-11-21 15:38

>>2
"vnimages/B27b_.eri : [this is the input file]
 --> hentaipics/*.eri.png [this is a supposed output file]
Can't write"

Fellow sussmans, help.

Name: Anonymous 2012-11-21 17:05

You won't be getting any susscoins, I did it myself.

Name: Anonymous 2012-11-21 17:24

>>8
I don't a shit.

Name: Anonymous 2012-11-21 19:21

>>8
And you're not going to post the solution for someone with the same problem to stumble across? Thanks!

Name: Anonymous 2012-11-21 20:19


$ man basename
$ man dirname
$ man sed
$ ed ~/bin/convertmany
i
#!/bin/sh

# XXX should accept these as command-line parameters
INDIR="~/shit/in"
OUTDIR="~/shit/out"

for i in "$INDIR"/*.eri; do
    penis="$(basename \"$i\" | sed 's/\\.eri$/.png/')"
    convert "$i" "$OUTDIR/$penis"
done
.
wq
$ chmod +x ~/bin/convertmany
$ convertmany

Name: Anonymous 2012-11-21 20:24

Why is bash so shitty?

Why do people need the feel to spam a textboard with 2 users with Unicode?

Name: Anonymous 2012-11-21 20:27

ed, man!

man ed

Name: Anonymous 2012-11-21 22:07

it's standard!

Don't change these.
Name: Email:
Entire Thread Thread List