Page 1 of 1

Post Script suddenly stopped working 2.2.0 Alpha1 [8483e4a]

Posted: June 22nd, 2017, 7:46 pm
by Jumbs
One of my scripts started failing on the line:

Code: Select all

cd $1

Something change with the passed arguments?

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 12:11 am
by safihre
Not that I am aware off..
Could you maybe post the whole script so we can check?

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 8:17 am
by Jumbs
Sorry, I forgot to include the error: line 5: cd: too many arguments

It could be something else, but the timing seems to correlate with the upgrade to the alpha, and i haven't change this script in years.

Code: Select all

#!/bin/bash
#
source ~/.personal

cd $1
if [ $? -eq 1 ] ; then
	exit	
fi
touch $Logloc/log
echo $1 >> $Logloc/log
ls >> $Logloc/log
chmod -R 644 *
mv * ~/$Start
rand=$RANDOM
if [ $? -eq 1 ] ; then
	mkdir ~/$Start/MoveErrorRescue$rand
	mv * ~/$Start/MoveErrorRescue$rand
fi

cd ~/$Start
rm $Logloc/log
mv $1 ~/.local/share/Trash/files


Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 11:14 am
by sander
Ah, then the cause is clear:

Code: Select all

$ cd /home/sander/some space/blabla/
bash: cd: too many arguments
... so a space in $1.

Can you try

Code: Select all

cd "$1"

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 11:50 am
by Jumbs
First off, i tried it on my friends who is running 2.1.0 [443efb5] and the same scripts as me. It worked fine. I even tried the exact same nzb.
So it definitely seems to be something between versions.

Thanks for the work around, i really should have thought of that.
I added quotes to all 3 references to $1 and it seems to be functional now. I will have to go through my other scripts.

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 12:32 pm
by sander
From https://sabnzbd.org/wiki/scripts/post-p ... ng-scripts
Please note: Use %1 in Windows scripts and $1 in Unix scripts. In Windows the parameters will be enclosed in double quotes ("my name").
On Posix systems (macOS, Linux, Unix) the parameters will not have quotes at all.

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 1:40 pm
by Jumbs
Good to know.

However it is going from working to not between versions, so you might get some complaints when it goes to release.

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 2:15 pm
by safihre
The thing is that nothing has changed with respect to post processing scripts. Maybe it was some other change on your machine that happend with same upgrade?
Because as Sander describes, Linux always needs the extra quotes.

Re: Post Script suddenly stopped working 2.2.0 Alpha1 [8483

Posted: June 23rd, 2017, 2:30 pm
by Jumbs
Who knows. My friends run linux as well, same OS and everything, no issues for them in 2.1.0.
I updated all my other scripts, so all good on my end.

Thanks.