Artificial intelligent assistant

Automatically fetch uid and gid in a command I'm using the below command to mount CIFS share, but I want to fetch the UID and GID automatically in the same command so that I don't have to enter it manually every time I `mount` on different machines. Any advice how? $ sudo mount -t cifs -o username=${USER},password=${PASSWORD},uid=<user>,gid=<group> \ //server-address/folder /mount/path/on/ubuntu

You can use the `id` command:


$ id
uid=1000(muru) gid=1000(muru) groups=1000(muru),4(adm),24(cdrom),27(sudo)...


Just the UID:


$ id -u
1000


Just the GID:


$ id -g
1000


So, using command substitution:


$ sudo mount -t cifs -o "username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g)" \
//server-address/folder /mount/path/on/ubuntu

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy f9744fdbb2167c9c76aaf2f13eae379f