Dave-ee Jones Posted April 28, 2017 Share Posted April 28, 2017 (edited) Hi guys, So I'm trying to call a shell script (.sh) from inside the payload.txt file (like install.sh or a.sh), but everything I have tried has come to nuttin'. I've tried things like this: chmod +x ./test.sh ./test.sh chmod +x ./test.sh bash ./test.sh chmod +x ./test.sh sh ./test.sh chmod +x ./test.sh source ./test.sh chmod +x ./test.sh ( "./test.sh" ) But none are working. I have the '#!/bin/bash' shebang on the first line of the shell script AND the payload.txt, and the shell script is in the same directory as the payload.txt. EDIT: I did also try removing the './' from the chmod call when I specify the filename. Any ideas on how to call on another script from the payload script? Edited April 28, 2017 by Dave-ee Jones Quote Link to comment Share on other sites More sharing options...
Dave-ee Jones Posted April 28, 2017 Author Share Posted April 28, 2017 Also noticed that if you serial into the BB and do this: chmod +x test.sh ./test.sh without a shebang, it works completely fine. It just doesn't like doing it from the payload script... Quote Link to comment Share on other sites More sharing options...
PoSHMagiC0de Posted April 28, 2017 Share Posted April 28, 2017 Try referencing the absolute path. source /root/udisk/payload/$SWITCH_POSITION/yourfile.sh Quote Link to comment Share on other sites More sharing options...
Dave-ee Jones Posted April 28, 2017 Author Share Posted April 28, 2017 (edited) 19 minutes ago, PoSHMagiC0de said: Try referencing the absolute path. source /root/udisk/payload/$SWITCH_POSITION/yourfile.sh I'm getting a solid red light. Not sure if it is because it doesn't like LED R G B or because it didn't like me calling source on a normal .sh file... Works. Made the separate .sh file say LED G instead and it worked fine. So the payload.txt file is run from a different directory, which means that looking for the test.sh file in the same directory wasn't going to work because it didn't exist...Makes sense I guess. Edited April 28, 2017 by Dave-ee Jones Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.