Sunday, January 7, 2018

2.3 gingerbread - How can I execute a script on the SD card and be able to pass arguments to it?


I tried executing a script on the sdcard as is because on FAT, everything is 777.


./.profile
./.profile: permission denied

I added this as the initial command for the Android shell and it executes it just fine:


eval "$(cat /sdcard/.profile)"


So what I'm wondering is: Is there a way I can execute a script on the sdcard (other than the way I found out) and be able to pass arguments to it or do I need to do it the normal BTEP way (in its data directory)?



Answer



Moved from comments and expanded.


Invoking the script with the shell directly sh .profile arg1 arg2 should work. If it become cumbersome to invoke the shell and typing the arguments, you can also create an alias, most terminal emulators allows you to specify an initial command to run at the start of a session.


No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...