1

Using Mint Linux 19 here.

I have a script file called test.sh. This script-file is located in a path e.g. /home/shyam/Mi A1/tissot, and I use it to flash Android system on my phone. The script contain command lines like:

fastboot $* flash modem_a `dirname $0`/images/modem.img
if [ $? -ne 0 ] ; then echo "Flash modem_a error"; exit 1; fi
fastboot $* flash modem_b `dirname $0`/images/modem.img
if [ $? -ne 0 ] ; then echo "Flash modem_b error"; exit 1; fi.....

The images folder mentioned in these commands is located in a separate folder in the same folder tissot and has files such as modem.img in the snippet above

  • adb and fastboot runs fine with the android device
  • Test.sh is executable as explained in Isiah's answer in How do I run .sh files

I tried to run the script by double clicking on the file and selecting run in terminal, but it did not work, nothing is flashed on in my phone and the terminal window banished in a jiffy.

Question

How do I run this file and see the output similar to "Target reported size...OKAY"

I am sure that the path in the test file does not match but I don't know how to fix that as also to see the output as explained for each line

1
  • 2
    Downvoting is fine but explaining reasons helps, which I understand is per SE culture
    – beeshyams
    Aug 30 '18 at 14:04
2

Open the terminal application (you can find it in the application menu) and run:

cd /home/shyam/Mi\ A1/tissot
chmod u+x test.sh
./test.sh

Each line is a command.

Keep in mind that running application found on the internet can be dangerous. Before doing this you should learn how to use the linux shell ( this is a good starting point: https://en.wikipedia.org/wiki/Bash_(Unix_shell) ) and understand what the program does.

4
  • +1. Thanks for response. will test it. 1. Meanwhile Mi**\** A1 - the backslash I suppose is to indicate the space ? 2. It is not a random file from internet. It is from the OEM and is not questionable at all . I simplified names 3. Yes, I should learn the right way but then I find it easier to learn and use what I need to get the job done (avoiding windows drivers and other issues )
    – beeshyams
    Aug 30 '18 at 14:46
  • yes the backslash is used to indicate the space. Aug 30 '18 at 14:52
  • Ok. I was able to "dry run" . Didn't want to test live on phone as I had already flashed it manually line by line earlier in day and set up the device . So in good faith accepting the answer . If you don't mind, what does fi at the end of each line in the snippet mean?
    – beeshyams
    Aug 30 '18 at 15:06
  • Never mind .Got the meaning of fi
    – beeshyams
    Aug 30 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.