I'm running this command to find the mounted network folder :
df | awk '/[email protected]/ { print $1 }'
This code is working fine but rather using 'andi' i want to pass it using 'USER' variable. It showing the correct value if I echo the USER var.
echo $USER
andi
But it's not working when I used the var . Seems the single quot pair is not working with $VAR :
df | awk '/[email protected]/ { print $1 }'
How should I use the var in this case ?
awk -v user=$USER '$1 ~ user {print $1}'will make thebashvariable into anawkvariable.awk -F@ ...