So, I play Minecraft on various Linux devices, and to sync progress between devices, I used a 32GB USB 3.0 Flash Drive (Overkill, I know) equipped with a folder containing the data from a .minecraft folder, and a Minecraft.jar file to launch the entire combo. Now, portable minecraft isn't that possible on linux, so I implemented an additional shell script file to copy the appdata to the user's (the one who runs the file) home folder and use sudo priviledges to rename the folder to .minecraft since cp omits hidden files.
Now, the question is, to copy the folder over from my pendrive, I need to navigate to the drive in question. But wait! For those of you who don't know, to navigate to a drive from cmd, you need to know the user's name. Now, I just want the whole experience to be seamless (by that I mean not opening the shell script every time and editing the user), so I need to know a way I could substitute the /media/user/MC path for a variable which automagically navigates to the drive in question. Oh, and while you're at it, I'd also like to find a way to copy the updated game files (after let us say building something and saving it) back to the flash drive.
Here's a sample of the code I was using to run Minecraft on plugging in the flash drive.
#!/bin/sh sudo rm -rf ~/.minecraft sudo cp -rn /media/pi0/MC/minecraft ~/ sudo mv /home/pi0/minecraft /home/pi0/.minecraft java -jar Minecraft.jar