chaoscreater
Active member
I have the following shell script and it works fine:
However, I don't want to hardcode the source file (ReVanced Extended.....). I want to target anything .txt file that is "Revanced Extended", i.e I need to use a wildcard here. So I updated my script to the following:
However, it doesn't execute at all and there's no output. I've tried a couple of different ways to do this and the script just does nothing.
I have a few other shell scripts that does Copy and Delete operations and they work fine. But when it comes to the above, nothing happens.
And yes I know there is a built-in MacroDroid task for file operations, but I'm trying to use a single shell script in combination with a Dictionary variable. I just need to update the source and destination path in the dictionary variable, without having to create multiple MacroDroid file operation Actions. I have specific use cases for this, hence why I'm using a shell script.
And before you ask, I'm using root shell and have also tried it with the helper app. Again, no problem with these settings for other shell scripts except this particular one.
mv "/storage/emulated/0/Download/ReVanced Extended_v19.02.39_2024-02-05.txt" "/storage/emulated/0/1. My Stuff/1. Settings Backup"
However, I don't want to hardcode the source file (ReVanced Extended.....). I want to target anything .txt file that is "Revanced Extended", i.e I need to use a wildcard here. So I updated my script to the following:
source_dir="/storage/emulated/0/Download"
target_dir="/storage/emulated/0/1. My Stuff/1. Settings Backup"
for file in "$source_dir"/*"Revanced Extended"*.txt; do
if [ -e "$file" ]; then
mv "$file" "$target_dir"
echo "Moved: $file"
fi
done
However, it doesn't execute at all and there's no output. I've tried a couple of different ways to do this and the script just does nothing.
I have a few other shell scripts that does Copy and Delete operations and they work fine. But when it comes to the above, nothing happens.
And yes I know there is a built-in MacroDroid task for file operations, but I'm trying to use a single shell script in combination with a Dictionary variable. I just need to update the source and destination path in the dictionary variable, without having to create multiple MacroDroid file operation Actions. I have specific use cases for this, hence why I'm using a shell script.
And before you ask, I'm using root shell and have also tried it with the helper app. Again, no problem with these settings for other shell scripts except this particular one.