Some help with Shell Programming
Some help with Shell Programming
am 24.04.2006 06:57:33 von noob bear
I m still new in Shell programming and I have some problems with it.
I need to make a program which will list down a number of files and it
will also state the total size used by the user. Any ideas or tips how
I can write this program?
Re: Some help with Shell Programming
am 24.04.2006 08:49:03 von me.linuxadmin
noob bear wrote:
> I m still new in Shell programming and I have some problems with it.
>
> I need to make a program which will list down a number of files and it
> will also state the total size used by the user. Any ideas or tips how
> I can write this program?
>From what I understood.....
make bash script.....
-----------------------------------------------
#!/bin/bash
x=`ls -l (your directory name without braces) | tr -s " " | cut -d " "
-f3,5`
echo "$x"
-------------------------------------------------
You can even do the above in the CLI...
try this out..if you have any problems do write back...Im new to shell
too, but Im sure others, more experienced people, will help you
Danish
Re: Some help with Shell Programming
am 24.04.2006 21:38:59 von Bill Marcum
On 23 Apr 2006 21:57:33 -0700, noob bear
wrote:
> I m still new in Shell programming and I have some problems with it.
>
> I need to make a program which will list down a number of files and it
> will also state the total size used by the user. Any ideas or tips how
> I can write this program?
>
du
--
Death comes on every passing breeze,
He lurks in every flower;
Each season has its own disease,
Its peril -- every hour. --Reginald Heber
Re: Some help with Shell Programming
am 25.04.2006 13:00:03 von noob bear
The script works! Thanks a lot ^_^
Re: Some help with Shell Programming
am 25.04.2006 13:45:55 von me.linuxadmin
noob bear wrote:
> The script works! Thanks a lot ^_^
I think you should read this
http://www.catb.org/~esr/faqs/smart-questions.html
While replying to a post, always do it the follwing way...
......click on show options->Reply....and then post your reply
Danish
Re: Some help with Shell Programming
am 29.04.2006 03:09:57 von RoadHard
On 23 Apr 2006 21:57:33 -0700, "noob bear"
wrote:
>I m still new in Shell programming and I have some problems with it.
>
>I need to make a program which will list down a number of files and it
>will also state the total size used by the user. Any ideas or tips how
>I can write this program?
Depends on the files you are looking for. All files or specific files?
#!/bin/ksh
ls -l /directory/path | awk '{print $5, $9}'
or
VARS=$(ls -l /directory/path | awk '{print $5, $9}')
for i in ${VARS}
do
command processing for each line
done
RoadHard
If the question is Micro$oft ... the answer is NO!