Page 3 of 3

Re: [BASH] How to create your own postprocessingscript

Posted: October 26th, 2016, 12:13 am
by Spamixxus
jcfp wrote:
Spamixxus wrote:

Code: Select all

#!/usr/bin/sh
echo $1 $2 $3 $4 $5 $6 $7 $8
python /var/db/sabnzbd/scripts/nzbToMedia/nzbToSickBeard.py $1 $2 $3 $4 $5 $6 $7 $8
python /var/db/sabnzbd/scripts/nzbToMedia/sabtowizznab.py $1 $2 $3 $4 $5 $6 $7 $8
With my sh script, the String is not one line, because the "" are missing.
Proper quoting of variables in your script is your own responsibility. Without quoting, thing go awry as soon as you try to pass an argument that just happens to be empty (these disappear) or contains spaces (one argument becomes multiple).

While you're at it, note there's "$@" as a shorthand for all arguments. So simply /path/to/script "$@" would work just fine without the need to write out $1 through $n.
Thank you very much, now it works all fine.
I use the "$@" in every line.

Code: Select all

#!/bin/sh
python /var/db/sabnzbd/scripts/nzbToMedia/nzbToSickBeard.py "$@"
python /var/db/sabnzbd/scripts/nzbToMedia/sabtowizznab.py "$@"

[02:53:54] [INFO]::MAIN: Loading config from [/media/scripts/nzbToMedia/autoProcessMedia.cfg]
[02:53:59] [INFO]::MAIN: The /media/scripts/nzbToMedia/nzbToSickBeard.py script completed successfully.
uploading file /media/nzbs/nzbbackup/*.gz...