I'm trying to write a shell script to perform actions if a users home directory if over a certain size. Unfortionately when I try to use the read command to split up the du -s
output I get 'command not found' since it tries to pass the number through to the shell, not into a variable like I want. Here's what I have so far for the script.
#!/bin/bash
cd /home
for i in `ls`
do
j=`du -s $i`
#this line gives me the error
k=`$j |read first;`
done
I get output like the following:
./takehome.sh: line 6: 3284972: command not found
where 3284972 is the size of the directory.