Getting disk usage for each user
The shell does a single pass on expanding parameters, so $user
is expanded, but the preceding ~
isn't then expanded. In order to reparse the input line, use eval
:
...
eval sudo du -sh ~$user
...
The shell does a single pass on expanding parameters, so $user
is expanded, but the preceding ~
isn't then expanded. In order to reparse the input line, use eval
:
...
eval sudo du -sh ~$user
...