Jump to content

[SOLVED] Call separate .sh script from payload.txt

Dave-ee Jones

Recommended Posts

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

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 by Dave-ee Jones
Link to comment
Share on other sites

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


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 by Dave-ee Jones
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...