I'm trying to create a bash shell script that will take an input directory and give me the name and size (with units) within. I'm a bit new to shell scripts, so I've been able to build the script to take the argument and assure it is a single directory, but I'm stuck after the ls command. I want to simplify it down to just file name and size.
closed as unclear what you're asking by muru, Scott, cuonglm, Anthon, dr01 Feb 17 at 8:05Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question. |
|||||||||
|
Try below code
if you want to use only 'ls' command output, then try the way suggested by piyush. i.e. instead of
use
option 'h'(du -ksh, ls -lh) will convert the size to 'human readable' formats(KB,MB,GB). |
|||||||||||||||||||||
|