How do I run a .bin file in another directory in a script?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do I run a .bin file in another directory in a script?
# 1  
Old 11-29-2010
How do I run a .bin file in another directory in a script?

The way this works from the command prompt is:
___________________________________________
cd /data/local/bin
chmod 0755 file.bin
./file.bin
_______________________________________________
How do I make this happen in a script. The file must be run in its directory but I can not get the script to actually change directory.
At script execution cd works but the other two commands "file not found"

I can make it look like the file is being executed if I make the script read:
cd /data/local/bin;chmod 0755 file.bin;./file.bin

It will not run properly because it is really running in whatever directory the script is in.
# 2  
Old 11-29-2010
Code:
 /data/local/bin/file.bin

will run the file named file.bin.

Is there a reason for the .bin filename extension? It is unusual in UNIX to name executable files that way, except for really old UNIXes like DGX.
# 3  
Old 11-29-2010
Quote:
Originally Posted by jim mcnamara
Code:
 /data/local/bin/file.bin

will run the file named file.bin.

Is there a reason for the .bin filename extension? It is unusual in UNIX to name executable files that way, except for really old UNIXes like DGX.
No, I get the same result. The file looks like it is running but...

It is a real .bin file designed to root a phone but it must be run in that directory. Command prompt works flawlessly, but not from a script.

I am using Windows 7 with the Android Debug Bridge. The phone operates under a Linux system, the adb gets you in a shell on the phone where you can do what you want or know how to do. If the .bin files works you know it worked because the phone will reset. I do not get that reset from the script.

I am writing a DOS batch file that will root and unroot the phone. That means that I have write 'adb shell "do something;do something else" '

I just can not make it go to another directory and then execute commands, they all get executed from the "/" directory.

Thanks

---------- Post updated at 12:18 PM ---------- Previous update was at 08:26 AM ----------

Quote:
Originally Posted by jim mcnamara
Code:
 /data/local/bin/file.bin

will run the file named file.bin.

Is there a reason for the .bin filename extension? It is unusual in UNIX to name executable files that way, except for really old UNIXes like DGX.
I finally got it an hour ago:
adb shell "./data/local/tmp/rageagainstthecage-arm5.bin & sleep 300;kill $!"
echo Reconnecting in 20 sec...
adb kill-server

adb start-serve

Thanks for ur interest.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to convert my /bin/sh script with cgi and html to run it on browser!??

Hello, I want to run this script on my CentOS 6 via browser : ________________________________________________________________________________________________ #!/bin/sh echo Username? read MY_NAME echo Provisional file name? read MY_FILE echo File NAME you want to save? read MY_FILE2... (16 Replies)
Discussion started by: juta2020
16 Replies

2. Red Hat

Chroot: cannot execute /bin/sh: No such file or directory

Hi Expert, I'm having grub problem here: grub> root (hd0,0): Filesystem type is ext2 grub> setup Error 11 : Unrecognized Device String I try install boot loader follow the instruction from 26.2. Booting into Rescue Mode It says : select Continue, it attempts to mount your file... (4 Replies)
Discussion started by: justbow
4 Replies

3. Shell Programming and Scripting

-bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory

I keep getting this error and I am not sure why. -bash: ./p4: /bin/ksh^M: bad interpreter: No such file or directory First I run my makefile and this works fine: goodmain: main.o gcc -o goodmain main.o main.o: main.c gcc -c main.c Then I want to limit my output so I... (11 Replies)
Discussion started by: cokedude
11 Replies

4. Solaris

/bin/find: stat() error <File> : No such file or directory

Hi, I am getting below error in Solaris 10 SPARC when trying to issue a search on /var/tmp partition Below is the query /bin/find /var/tmp/ -type f -atime +1 Below is the result /bin/find: stat() error <File> : No such file or directory (28 Replies)
Discussion started by: prash358
28 Replies

5. Shell Programming and Scripting

#!/bin/bash cannot find file or directory

Hello, When i run a bash script on ubuntu i get this message.. #!/bin/bash cannot find file or directory... Can anibody help me with this, because the file actually exists.... Is there any extra configuration to be made? (5 Replies)
Discussion started by: oliveiraum
5 Replies

6. IP Networking

effects of bin file stored in nfs & run as daemon

Hi, Good Day, I had this question in my mind.Hope someone can give me his/her thought about it. Question: I had a binary files stored in the nfs system and mounted several workstation locally and running as deamon. Is there in effect to the networks or any problem me arise regarding network... (3 Replies)
Discussion started by: jao_madn
3 Replies

7. Shell Programming and Scripting

can I run a exe which is at bin dir from my script.

Hello forum memebers. I have command which is exe of C- program from my script.i am writing a script which is under path /abc/xyz/test.sh. the script consist the command which is the exe of c-prog and the exe is present in the /abc/xyz/bin.if run the command from the /abc/xyz its running and if... (3 Replies)
Discussion started by: rajkumar_g
3 Replies

8. UNIX for Advanced & Expert Users

#!/usr/bin/env : perl no such file or directory

hi i have some perl scripts with shebang line as (#! /usr/bin/env perl ) instead of actual absolute path of perl ( i know why its that way ) everything works fine from command line , the problem is when i am trying to run those scripts from web ( local web tool ) it throws error as /usr/bin/env :... (6 Replies)
Discussion started by: zedex
6 Replies

9. Shell Programming and Scripting

How to make a script to run everytime a new file is copied into a directory??

Hi folks I have a unix script script1 in a directory folder1 and also I have few input log files in this directory. My input log files will be copied into this directory folder1 from the portable thumb drive. Now what I want is I need to run this script1 whenever any new file is copied... (2 Replies)
Discussion started by: ks_reddy
2 Replies

10. UNIX for Dummies Questions & Answers

/bin/sh: /usr/bin/vi: No such file or directory when doing crontab

I just set up an ftp server with Red Hat 5.2. I am doing the work, I'm baby stepping, but it seems like every step I get stuck. Currently, I'm trying to set up a crontab job, but I'm getting the following message: /bin/sh: /usr/bin/vi: No such file or directory. I see that vi exists in /bin/vi,... (3 Replies)
Discussion started by: kwalter
3 Replies
Login or Register to Ask a Question