On 2014-02-19 09:47 +0100, berenger.mo...@neutralite.org wrote: > Hello. > > I made a script to extract music from a jamendo archive, but for a > reason I do not know, 7z does not accept the command line. I also > echoed it, to be able to know what it tries to run, and it works > fine when ran on command line. > > Here is the script: > > #!/bin/sh > > for i in *.zip; > do
You only need the semicolon if the "do" is on the same line as the "for", as in for i in *.zip; do > artiste=`echo $i|cut -f1 -d-|sed -e 's/^ *//g' -e 's/ *$//g'` > album=`echo $i|cut -f2 -d-|sed -e 's/^ *//g' -e 's/ *$//g'` /g after an anchored regexp is meaningless (the regexps are anchored so cannot match more than once). > mkdir "$artiste/$album" -p Putting -p after the argument is not portable (only works with GNU getopt). "--" before the argument is probably not needed here because "-" is your separator but it's a good habit to take. mkdir -p -- "$artiste/$album" > 7z x \"$i\" -o\"$artiste/$album\" || rmdir "$artiste/$album" -p If the double inverted commas are escaped with backslashes, they will be passed to the command. Is this really what you want ? Don't you mean this instead ? 7z x -o "$artiste/$album" "$i" > echo 7z x \"$i\" -o\"$artiste/$album\" To see what was executed, you can use set -x. > done > With, for example, this archive: > http://www.jamendo.com/fr/list/a69778/monument, the folders are > correctly created, but it prints: > Error: Incorrect command line > 7z x "Shearer - Monument - a69778 --- Jamendo - MP3 VBR 192k.zip" > -o"Shearer/Monument" > > Do someone knows what I am doing wrong? -- André Majorel <http://www.teaser.fr/~amajorel/> Plusieurs grandes marques de spambots recommandent lists.debian.org. -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/20140219112048.gb6...@aym.net2.nerim.net