This page last changed on Mar 15, 2014 by icefluffy.

Hi all,

I'm trying to add 2 numeric variables in a script running on my Synology NAS.

I can't seem to get it working:

timeout_in_seconds=10
current_time_in_seconds=$(date "+%s")
echo $timeout_in_seconds
echo $current_time_in_seconds
trigger_time_in_seconds=$(($timeout_in_seconds+$current_time_in_seconds))
echo $trigger_time_in_seconds

This code just doesn't make the sum of the variables!!
Anyone have any ideas please?

It does work on my Synology DS1512+ with DSM 4.3

Posted by aktur at Mar 16, 2014 10:06

I have a DS213+ with DSM4.3, maybe it has something to do with that...

Posted by icefluffy at Mar 16, 2014 14:15

With Putty the sh does work on my DS212+ console:
10
1394986115
1394986125

Posted by pz1 at Mar 16, 2014 16:11

I get:

10
1394987224
+1394987224tPhone.sh: line 5: syntax error: 10

Posted by icefluffy at Mar 16, 2014 16:28

With which shell you are calling it? I've tried it with /bin/sh and /opt/bin/bash. Both give the correct answer.

Posted by aktur at Mar 16, 2014 16:56

I've tried both...

Posted by icefluffy at Mar 16, 2014 17:29

To be complete:

Using vi I made test.sh

next
chmod +x test.sh

next
./test.sh

Posted by pz1 at Mar 16, 2014 17:33

Nope...

trying this didn't help either :

Re: bash as shell and MC with subshell toggle

Postby johnk.dev.null ยป Tue Sep 03, 2013 6:23 pm
What maxxfi said is important ... so ...

Keep /bin/ash as your root shell and in /root/.profile add these lines at the end -

Code: Select all
if [[ -x /opt/bin/bash ]]; then
exec /opt/bin/bash
fi

This gives you a bash root shell with no risk when upgrading DSM or if you lose /opt.
Next create /root/.bashrc and add these lines -

Code: Select all
PS1='\u@\h:\w \$ '
export SHELL=/opt/bin/bash

The first line gives you a nice bash prompt. The second explicitly sets the SHELL variable to your correct shell. Ctl+O now works once you have logged out and back in again.

As always when changing root shell settings, keep a separate root shell window open until you have confirmed all of the changes work.

Regards JohnK

I'm giving up for tonight I think...

Posted by icefluffy at Mar 16, 2014 18:36
Document generated by Confluence on Jun 05, 2016 09:39