Tiny Core Linux

Tiny Core Extensions => TCE Talk => Topic started by: Daniel on May 10, 2011, 04:03:01 AM

Title: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 10, 2011, 04:03:01 AM
Hi,

I've got scripts to on/off backlight.
The commands pass with /dev/ttyUSB0 access
Command example:
 
Code: [Select]
echo -ne "B255\r" > /dev/ttyUSB0
It runs ok when script is executed directly : backlight ON / OFF ok.

When i call one script from an other script, no change on backlight !

I'm root!

I'm thinking about environment variables ... but ?

Thanks
Daniel.


Title: Re: Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 12, 2011, 07:57:12 AM
Script and application are launched in sh.

Adding #!/bin/bash at the beginning of the script make it runs!

In fact, bash is default : the reason because script direct execution is ok.

Daniel.
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: tinypoodle on May 12, 2011, 09:31:15 AM
It is simply wrong to declare scripts containing bashisms as #!/bin/sh
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 12, 2011, 09:50:51 AM
I've got big scripts in sh ... no time to convert and test them now :(

New scripts are written with bash  ;D

Thanks
daniel.
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: tinypoodle on May 12, 2011, 10:28:43 AM
New scripts are written with bash  ;D

Umm... It would be equally wrong to declare POSIX shell compatible scripts as #!/bin/bash   ::)
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 12, 2011, 10:31:10 AM
Then, what is the best thing to do ?

D.
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: curaga on May 12, 2011, 10:33:25 AM
Umm... It would be equally wrong to declare POSIX shell compatible scripts as #!/bin/bash   ::)

How's that? Bash is posix compatible, so it's merely resource overhead.
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: tinypoodle on May 12, 2011, 10:39:03 AM
Then, what is the best thing to do ?

D.

Declare only those scripts which contain bashisms as #!/bin/bash
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: tinypoodle on May 12, 2011, 10:45:19 AM
Umm... It would be equally wrong to declare POSIX shell compatible scripts as #!/bin/bash   ::)

How's that? Bash is posix compatible, so it's merely resource overhead.

bash can run in POSIX compatibility mode [which it doesn't when invoked by #!/bin/bash - but that's beside the point here], but declaring POSIX shell compatible scripts as #!/bin/bash unnecessarily reduces compatibility/portability
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 12, 2011, 11:19:18 AM
I've got big scripts in sh ... no time to convert and test them now :(

I said convert sh script in bash, not replace sh with bash! :)


hum ... now, my script is functionning : what i wanted.
And i know why :)

Thanks
daniel.
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: tinypoodle on May 12, 2011, 12:23:05 PM
I said convert sh script in bash, not replace sh with bash! :)

There seems to be a language barrier issue making communication difficult   :-\
Title: Re: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem
Post by: Daniel on May 12, 2011, 12:35:13 PM
eternal communication problem between men!
 :'(
lol

D.