Help with shell script..

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

  1. The problem statement, all variables and given/known data:

Write a script, which will run using the Bourne shell, and store it in file
morethan100k which will inform the user if they have used more than 100k of
disk space? this is the complete question

  1. Relevant commands, code, scripts, algorithms:

none as yet

  1. The attempts at a solution (include all code and scripts):

have not attempted this, as i need pointed in the right direction

  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):

University of Ulster, prof Kenny Adamson, Jordanstown, Northern Ireland, Com 332 <--- module code

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

cd
find . -ls | awk '{sum+=$7}END{x=(sum>(1024*100))?1:0;if (x) print sum > "morethan100K"; print (x)?"your 100K quota has been exceeded":"Quota OK"}'

i was going down the route of finding the amount of space used.. clearly wrong thanks

You could tweak the find command to make it more accurate by only searching for the file owned by the concerned user.

man find

is there any way i can use echo to print the free space to the terminal? just instead of to another file

Please don't post one-line ready-made solutions in the homework forum.

Especially without good explanation.

The O/P is looking to be guided, not spoon-fed.

see for this i think that answer was a bit too complicated to be an answer that i could have done, is there simpler way.. using df or free command or something

Perhaps you should start by looking at the du command.

It's not clear if morethan100k is the script name, or the file which shows the user's usage.

ok in the terminal i can now get the total disk usage which is great... now tho need to create a script to execute from the terminal,
if [du -s -gt 100 ];
then echo "You have used more than 100k of disk space"
else echo "You have not used more than 100k of disk space"
fi

i tried doing this, but it doesnt seem to like the du command..

it is the script name

i now have this i am however having trouble comparing this output to a number
SIZE=`du -s`
echo $SIZE
test $SIZE -gt 100 && echo You have used more than 100k of disk space ||
echo You have not used more than 100k of disk space