0

Why are mounted media mounted under /media/<user>/ in Ubuntu 16 counter to how it used to be under /media/?

And, how can I grab the <user> part if I want a script to work in case of username change? (for example, for /home/<user> I use $HOME)

Solution:

  • first part answered here
  • second part: $USER
user10853
  • 1,566
  • 1
    You said "if I want script to work". What script and what it is supposed to do ? – Sergiy Kolodyazhnyy Oct 30 '16 at 23:21
  • @Serg I don't think it is relevant, nevertheless it's just an alias to a standalone software that is stored on another partition. I said script for others and for my future reference when writing one. – user10853 Oct 30 '16 at 23:44
  • Alright. There's a few ways that you can work around getting the username, mounting, and referencing specific partitions. I usually prefer to know what are the "customer requirements" so that one can find best approach. You seem like you've find what you wanted, but let me know if you're interested in alternatives – Sergiy Kolodyazhnyy Oct 31 '16 at 00:11
  • @Serg You're absolutely right. In my case it's a simple alias but yes I am interested in alternatives if they are better or different than below. – user10853 Oct 31 '16 at 00:40

2 Answers2

4

Probably you can use the $USER variable? If you're new in scripting have a look at some basic guides like this

As for the change in path - here is good explanation from other similar question at AskUbuntu.

2

You answered part of your own question; however, I wanted to get you an actual answer to your question of "why?"

Answer to "why" is at this post: How to configure the default automount location?

To actually get the user part, you have three options:

whoami
echo $USER
echo $LOGNAME
D75
  • 142