LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-07-2006, 03:16 AM   #1
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Rep: Reputation: 33
do a calculation for block sice


Hi

I want to write a small script to get the block size in Bytes in a file system.


FS=/vol1

du -bs $FS = value assign to FSBY
du -s $FS = value asinine to FSBL

and do

FSBY/FSBY= "one block in bytes"

and assign that value the result to a variable for further processing



Regards

Asanka
 
Old 07-07-2006, 03:33 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Did you read man bash ?
FSBY=$(du -bs $FS)
FSBL=$(du -s $FS)
echo $((FSBY/FSBL))
 
Old 07-09-2006, 05:49 AM   #3
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
Hi Raskin

I am realy new to all this

regards

Asanka
 
Old 07-09-2006, 11:17 AM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
This doesn't make man bash (and info bash) less valuable reading for everyone who wants to write useful scripts in Bourne again shell...
 
Old 07-10-2006, 09:33 PM   #5
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
hi raskin

Can we migrate windows 2003 AD to samba 3 with LDAP on linux

regards

Asanka
 
Old 07-11-2006, 12:22 AM   #6
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Not my topic. Do ask in a separate thread with samba in header.
 
Old 07-11-2006, 01:09 AM   #7
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
I did but ????????????????
 
Old 07-11-2006, 04:47 AM   #8
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Maybe nobody now reading is sure that it is impossible - or just nobody tried.. Then ask about good manuals on samba/LDAP and try yourself. I really have only one experience of samba - running smbmount (yes, client only) on FreeBSD 3 years (as I remember) ago...
 
Old 07-12-2006, 12:48 AM   #9
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
Hay raskin

when you do du the output is proceeded by a dot. How can I only get the numeric value of du output

Regards

Asanka
 
Old 07-12-2006, 01:35 AM   #10
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Didn't understand. Do you wnat something like
du -s "$PATH" | sed -e 's/\s.*//'
?
 
Old 07-12-2006, 01:51 AM   #11
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
When I do du -s

25176 .

how can I only get teh 25176 with out the "." and spaces

Regards

Asanka
 
Old 07-12-2006, 01:58 AM   #12
raskin
Senior Member
 
Registered: Sep 2005
Location: Russia
Distribution: NixOS (http://nixos.org)
Posts: 1,893

Rep: Reputation: 68
Did you test my code? It should work.
 
Old 07-12-2006, 02:27 AM   #13
procfs
Member
 
Registered: Jan 2006
Location: Sri Lanka
Posts: 476

Original Poster
Rep: Reputation: 33
Sorry I did not chack

yes it works

Thank your raskin
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User quota, block size calculation procfs Linux - General 8 09-24-2010 10:05 AM
Clients BandWidth Calculation ahmad82pkn Linux - Networking 0 10-22-2005 08:38 AM
Help needed regarding bandwidth calculation russoue Programming 2 07-13-2005 09:51 AM
c math calculation alaios Programming 3 06-01-2004 01:46 AM
Load average calculation ? mikeshn Linux - General 4 08-27-2003 02:53 PM


All times are GMT -5. The time now is 02:25 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration