0

chd.sh

#! /bin/bash
cd django/hellodjango
exec bash
python manage.py runserver

chd.py

# a=`python chd.py`;cd $a
import os
new_dir = "django/hellodjango"
os.chdir(new_dir)

are the two ways I have tried. Also, on terminal I have tried,

.  chd.sh

./chd.sh

. ./chd.sh

I have also tried to assign to variable and then run on terminal but no success. Spent over 4 hours trying multiple methods given on stackoverflow.com but no success yet. The only thing that has worked yet is,

alias mycd='cd django/hellodjango'

But I will have to copy paste it everytime.

alias myrun = `cd django/hellodjango && python manage.py runserver`

And,

alias myrun = `cd django/hellodjango; python manage.py runserver`

doesn't work. This is just a sample, there are so many django commands that I have to use repeatedly. Appreciate if you have read all this way. If you know the link where this is discussed, please attach the link, as I was not able to find after hours of search. Edit:

 /storage/emulated/0 $

This is what the prompt appears like.

/storage/emulated/0/django/hellodjango

This is the path.

/storage/emulated/0 $ cd django/hellodjango
/storage/emulated/0/django/hellodjango $ python manage.py 
runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
July 25, 2020 - 19:08:42
Django version 3.0.7, using settings 'hellodjango.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Individually works fine.

Edit:

/storage/emulated/0 $ chmod u+x chd.sh /storage/emulated/0 $ chmod u+x rn.sh /storage/emulated/0 $ ./chd.sh ./chd.sh: cd: line 2: can't cd t: No such file or directory /storage/emulated/0 $ chmod u+x chd.py /storage/emulated/0 $ a=python chd.py;cd $a ~/data/ru.iiec.pydroid3/app_HOME $

Edit:

/data/user/0/tech.ula/files/support/dbclient: Caution, skipping hostkey check for localhost

subham@localhost's password: subham@localhost:~$ ls subham@localhost:~$ cd subham@localhost:~$ pwd /home/subham subham@localhost:~$ pkg install miniconda

-bash: pkg: command not found subham@localhost:~$ apt install miniconda Reading package lists... Done Building dependency tree Reading state information... Done

E: Unable to locate package miniconda subham@localhost:~$

subham@localhost:~$ cd .. subham@localhost:/home$ cd .. subham@localhost:/$ ls

bin dev host-rootfs mnt root srv
sys var boot etc lib opt run storage tmp data home media proc sbin support usr subham@localhost:/$ cd ..

subham@localhost:/$ cd sys subham@localhost:/sys$ ls

ls: cannot open directory '.': Permission denied

subham@localhost:/sys$ cd..

-bash: cd..: command not found subham@localhost:/sys$ cd ..

subham@localhost:/$ cd storage

subham@localhost:/storage$ ls internal subham@localhost:/storage$ cd internal subham@localhost:/storage/internal$ ls subham@localhost:/storage/internal$ ls -l total 0 subham@localhost:/storage/internal$ cd 0

-bash: cd: 0: No such file or directory subham@localhost:/storage/internal$

subham@localhost:/$ chmod -R 777 /host-rootfs
chmod: changing permissions of '/host-rootfs': Read-only file system
chmod: cannot read directory '/host-rootfs': Permission denied
subham@localhost:/$

https://github.com/CypherpunkArmory/UserLAnd/issues/46

Subham
  • 397
  • 1
  • 6
  • 14
  • 1
    Have no idea what a *pydroid inbuilt terminal* is, but wrt the bash script, the line after `exec bash` is not even read unless no executable named `bash` is found in the directories listed in PATH and the script is sourced from an interactive shell, and wrt the python script, changing the directory for the python process won't change the directory for the shell that invokes it. – oguz ismail Jul 25 '20 at 13:31
  • Did you `chmod u+x` chd.sh and chd.py? – l3l_aze Jul 26 '20 at 03:05
  • @l3l_aze made changes posted as edit the output error – Subham Jul 26 '20 at 03:37
  • [Possibly related Q?](https://stackoverflow.com/q/4256107/7665043), especially [this great answer](https://stackoverflow.com/a/51950538/7665043) which details running Bash code from Python. Also, this is just kind of a weak terminal. UserLAnd or another chroot Linux environment would be closer to full functionality, even Termux. – l3l_aze Jul 27 '20 at 18:01
  • @l3l_aze tried UserLAnd but getting following error. How do I navigate to the files chd.sh or chd.py – Subham Jul 27 '20 at 19:58
  • The UserLAnd-specific `/host-rootfs/` maps to Android's root folder, `/`. So, internal storage should be available from `/host-rootfs` at `/storage/emulated/0`, `/sdcard` (a symlink to /storage/emulated/0`), or `/mnt/sdcard` (another symlink). The rest depends on where your files for your project are from there, but in your above edits it looks like they're directly in `/sdcard/`. There are pre-packaged anaconda/miniconda installers on their site for installation, and you can download them in your browser and access them in `host-rootfs/sdcard/Downloads/`. – l3l_aze Jul 27 '20 at 21:10
  • Changing what you're using may have been a bad idea, as it seems to be just making everything more complex. I'm sorry. You may need to rewrite the question title + content to explain what you're trying to do rather than what you're having a problem doing. As it's gotten pretty messed up you could possibly have this closed and post a new question instead. – l3l_aze Jul 27 '20 at 21:13
  • subham@localhost:/host-rootfs/storage/emulated/0$ chd.sh-bash: chd.sh: command not found subham@localhost:/host-rootfs/storage/emulated/0$ . chd.sh -bash: chd.sh: Permission denied subham@localhost:/host-rootfs/storage/emulated/0$chmod u+x chd.sh subham@localhost:/host-rootfs/storage/emulated/0$chmod u+x chd.py subham@localhost:/host-rootfs/storage/emulated/0$chd.sh-bash: chd.sh: command not found subham@localhost:/host-rootfs/storage/emulated/0$bash chd.sh bash: chd.sh: Permission denied – Subham Jul 28 '20 at 09:32
  • >subham@localhost:/host-rootfs/storage/emulated/0/django$ chmod u+x Miniconda3-latest-Linux-x86.sh >subham@localhost:/host-rootfs/storage/emulated/0/django$ bash Miniconda3-latest-Linux-x86.sh bash: Miniconda3-latest-Linux-x86.sh: Permission denied >subham@localhost:/host-rootfs/storage/emulated/0/django$ – Subham Jul 28 '20 at 09:38
  • @l3l_aze installing desktop environment hasn't helped much either – Subham Jul 28 '20 at 12:37

0 Answers0