WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Script execution called by a script with /dev/ttyUSB0 access problem  (Read 4363 times)

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
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.


« Last Edit: May 12, 2011, 07:57:33 AM by Daniel »

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
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.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
It is simply wrong to declare scripts containing bashisms as #!/bin/sh
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
I've got big scripts in sh ... no time to convert and test them now :(

New scripts are written with bash  ;D

Thanks
daniel.
« Last Edit: May 12, 2011, 10:41:14 AM by Daniel »

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
New scripts are written with bash  ;D

Umm... It would be equally wrong to declare POSIX shell compatible scripts as #!/bin/bash   ::)
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
Then, what is the best thing to do ?

D.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
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.
The only barriers that can stop you are the ones you create yourself.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Then, what is the best thing to do ?

D.

Declare only those scripts which contain bashisms as #!/bin/bash
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
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
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
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.

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
I said convert sh script in bash, not replace sh with bash! :)

There seems to be a language barrier issue making communication difficult   :-\
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline Daniel

  • Full Member
  • ***
  • Posts: 166
eternal communication problem between men!
 :'(
lol

D.