linux - Bash script, output folder content and bytesize without using ls -
linux - Bash script, output folder content and bytesize without using ls -
i working on bash script. script should display content of folder , byte size. normaly utilize ls command in excercise can't utilize it. output on display must in format "file_name:bite_size" trying hours this:
#!/bin/bash ifs=" "; string="$(du -bc /var/*)"; textarray=($string); ((i=0; i<${#textarray[@]}; ++i)); echo "${textarray[$i]}"; done exit 0;
i on right way or totally wrong?
maybe like:
stat --format="%n:%s" *
linux bash variables output
Comments
Post a Comment