I have a problem with executing bash script on Android or TWRP. I use BusyBox 1.34.1 with Termux application. The command that I use is du. All the time when I use variable with path in script I receive the error Inaccessible or not found.
When I use static path I got the correct values:
Script:
#!/bin/bash
mainLocation="/data/media/0/!Temp/!Test"
echo "Rozmiary katalogow:"
du -hd 1 /data/media/0/!Temp
Executing:
sh script3.sh
: inaccessible or not found
: inaccessible or not found
Rozmiary katalogow:
697M /data/media/0/!Temp
But when I use the path from variable I got the error with no values:
Script:
#!/bin/bash
mainLocation="/data/media/0/!Temp"
echo "Rozmiary katalogow:"
du -hd 1 "$mainLocation"
Executing:
sh script3.sh
: inaccessible or not found
: inaccessible or not found
Rozmiary katalogow:
: No such file or directory
So where is the problem?