There are a couple of good ways to manipulate your files and directories in Bash. We'll give you the most important commands for writing PlayOnMac scripts.
You can use a temporary directory in your script.
POL_System_TmpCreate "NameOfTemporaryDirectory"
It is recommended to use the name of the prefix as temporary directory name.
POL_System_TmpCreate "MozillaFirefox"
It will create a variable $POL_System_TmpDir that will contain the path of the temporary directory.
In this directory, you'll be free to store and modify all the files you want, for the whole script duration.
POL_System_TmpDelete
POL_System_TmpDelete
Note that it's useless to remove the files you created in the temporary directory before calling the POL_System_TmpDelete command.
cd "path"
cd "/path/to/a/directory"
cd "$HOME" # Switch to user's personal directory
cd "$CDROM" # Switch to CD/DVD directory
cd "$POL_System_TmpDir" # Switch to temporary directory
Warning, this command is very dangerous. It could destroy all your files if you don't handle it properly. For example, if you decide to remove /home/user/.PlayOnLinux/tmp/ and that you inadvertently insert a blank between /home/user/ and .PlayOnLinux, you can say farewell to your documents. PlayOnMac could not be held responsible for any mishandling on your part.
rm "filename"
rm -r "directory"
rm "$POL_System_TmpDir/file.txt"
rm -r "$POL_System_TmpDir/directory"
If they are any remaining files and/or subdirectories in the directory you're removing, they'll also be removed for good.
cp "SourceFile" "TargetFile"
cp -r "SourceDirectory" "TargetDirectory"
cp "/home/user/file.txt" "/home/user/copy_of_file.txt"
cp "/home/user/file.txt" "/home/user/data/file.txt"
cp "$CDROM/file.txt" "$POL_System_TmpDir/file.txt"
cp -r "/home/user/My Folder" "/home/user/Desktop/Test/"
mv "/home/user/file.txt" "home/user/data.txt"
mv "/home/user/file.txt" "/home/user/Desktop/file.txt"
mv "/home/user/file.txt" "/home/user/Desktop/data.txt"
1st command will rename the file file.txt to data.txt.
2nd command will move the file.
3rd command will move AND rename the file.