Answer the question
In order to leave comments, you need to log in
How to "unpack" parameters from a variable in a bash script?
There is a simple script to display the size of the home directory, excluding some directories:
du -sh ~ --exclude=$HOME/{.cache,.config/google-chrome,Загрузки}
excludes=".cache,.config/google-chrome,Загрузки"
du -sh ~ --exclude=$HOME/{$excludes}
[email protected]:~$ bash -x ./t.sh
+ excludes=.cache,.config/google-chrome,Загрузки
+ du -sh /home/sergey '--exclude=/home/sergey/{.cache,.config/google-chrome,Загрузки}'
2,2G /home/sergey
Answer the question
In order to leave comments, you need to log in
In your case it will work like this:
excludes=".cache,.config/google-chrome,Загрузки"
eval du -sh ~ --exclude=$HOME/{$excludes}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question