How to initialize a directory size to a variable??

Answers were Sorted based on User's Feedback



How to initialize a directory size to a variable??..

Answer / damodar rao

#!/bin/bash
echo 'enter the directory name with path Ex: /home/damoar: ';
read $x;
$size = `du -h $x`;
echo 'size of a given directory $x is : `$size` ';
:wq

Is This Answer Correct ?    3 Yes 0 No

How to initialize a directory size to a variable??..

Answer / pushkar

if [ -d $var ] ;then
rm -rf $var
fi
mkdir $var

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More Shell Script Interview Questions

What shell is bin sh?

0 Answers  


Explore about environment variables?

0 Answers  


What lives in a shell?

0 Answers  


How to make userdefined variables to available for all other shells?

4 Answers  


What is a shell made of?

0 Answers  






What is the first line in a shell script?

0 Answers  


Is shell scripting a programming language?

0 Answers  


I want to read all input to the command from file1 direct all output to file2 and error to file 3, how can I achieve this?

1 Answers  


what do u mean by $#,$* in unix programming?

5 Answers   Convergys, TCS,


How will I insert a line "abcdef" at every 100th line of a file?

2 Answers  


How do I set bash as default shell mac?

0 Answers  


What is shell and shell script?

0 Answers  


Categories