01-21-2010
Quote:
Originally Posted by
pludi
However, try both commands with the '-h' switch (for "human"), and you'll have sizes in GB too.
Yes, and there's a reason they put it in a switch. Most commands available in shell are designed to output data extremely consistently so other programs can use it predictably. If you know it'll always report 1K blocks, that's easy to build a shell script around -- but trying to parse mixed units like 115K, 2.2G and 441M would be a nightmare.
Lastly, always, always, always read the man pages before complaining about a lack of feature. You'd have found the -h flags in both commands. You'd also have found email addresses to report bugs to.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello
I want to make simple extension to vi , you know how you want to run some shell command
you do ":! ls -l " , then you go out the vi the command executed and then you hit enter and you back to vi
but now I want to be able to go out of vi and run several command outside of vi .. and in... (3 Replies)
Discussion started by: umen
3 Replies
2. Programming
Hi,
I have a database (a simple .dat file) which has multiple records (structure datatype) in it.
I would like to know if we can use write() system call to update/modify intermediate records in this file (using C). If so, could somegive give a code snippet of the same. :-)
Thanks in advance... (2 Replies)
Discussion started by: maverix
2 Replies
3. Shell Programming and Scripting
Hi,
I need to do frequently server down and up. Every time i am using nearly 5 to 6 commands to down and agin i am using the commands to up.
Can anybody help me to write a script to down and up.
which i can use once on unix platform it can down later it can up the server. (1 Reply)
Discussion started by: sreerao
1 Replies
4. Shell Programming and Scripting
Execute some commands in script and store result in excel sheet
Kindly help me........... (1 Reply)
Discussion started by: Computer_baby
1 Replies
5. Red Hat
I am using Fedora 8,Red hat 9.
Whenever we write a new command. Then we goto "/usr/bin" and then place this in this directory.And hence we can use it as a command anywhere from the terminal.
We generally see commands like "trap" which run only in bash shell.We also have other shell specific... (1 Reply)
Discussion started by: nsharath
1 Replies
6. Fedora
hi friends
i am using fedora linux operating system on the server and two clients(with windows os) are connected to it(server ).but here wall and write cmds are not working to send messages from one system to another system .
pls help me (4 Replies)
Discussion started by: sankar_vitam
4 Replies
7. UNIX for Dummies Questions & Answers
I have to
Write a program in C that recognizes the following commands and translates them into much simpler ones
Commands to recognize shorter command
list L
cd dir C - dir_length - dir
get file_name G - file_name_length - file_name
Long commands are read from the standard input and... (1 Reply)
Discussion started by: aintour
1 Replies
8. Homework & Coursework Questions
I have to
Write a program in C that recognizes the following commands and translates them into much simpler ones
Commands to recognize shorter command
list
L
cd dir
C - dir_length - dir
get file_name G - file_name_length - file_name
Long commands are read from the standard input... (1 Reply)
Discussion started by: aintour
1 Replies
9. Shell Programming and Scripting
I want to create a script with the php exec() or system() function to execute commands from a remote browser on the webserver. I am open to using Perl or whatever. I am using an Apache2 webserver on Ubuntu.
I have done quite a bit of research on this on google and read lots of responses about... (0 Replies)
Discussion started by: bash_in_my_head
0 Replies
10. Shell Programming and Scripting
can any one suggest me on how to write a update query in perl script for Oracle database and also tell me abt how we can write a code for sending mails with report as attachment to appropriate persons? (1 Reply)
Discussion started by: Ramesh V Kumar
1 Replies
ENVIRON(7) BSD Miscellaneous Information Manual ENVIRON(7)
NAME
environ -- user environment
SYNOPSIS
extern char **environ;
DESCRIPTION
An array of strings called the environment is made available by execve(2) when a process begins. By convention these strings have the form
``name=value''. The following names are used by various commands:
BLOCKSIZE The size of the block units used by several commands, most notably df(1), du(1) and ls(1). BLOCKSIZE may be specified in units of
a byte by specifying a number, in units of a kilobyte by specifying a number followed by ``K'' or ``k'', in units of a megabyte by
specifying a number followed by ``M'' or ``m'' and in units of a gigabyte by specifying a number followed by ``G'' or ``g''.
Sizes less than 512 bytes or greater than a gigabyte are ignored.
EXINIT A startup list of commands read by ex(1) and vi(1).
HOME A user's login directory, set by login(1) from the password file passwd(5).
PATH The sequence of directories, separated by colons, searched by csh(1), sh(1), system(3), execvp(3), etc, when looking for an exe-
cutable file. PATH is set to ``/usr/bin:/bin'' initially by login(1).
PRINTER The name of the default printer to be used by lpr(1), lpq(1), and lprm(1).
SHELL The full pathname of the user's login shell.
TERM The kind of terminal for which output is to be prepared. This information is used by commands, such as nroff(1) which may exploit
special terminal capabilities. See termcap(3) and terminfo(5).
TMPDIR The directory in which to store temporary files. Most applications use either ``/tmp'' or ``/var/tmp''. Setting this variable
will make them use another directory.
TZ The timezone to use when displaying dates. The normal format is a pathname relative to ``/usr/share/zoneinfo''. For example, the
command ``env TZ=US/Pacific date'' displays the current time in California. See tzset(3) for more information.
LOGNAME The login name of the user.
USER Deprecated synonym of LOGNAME (for backwards compatibility).
Further names may be placed in the environment by the export command and name=value arguments in sh(1), or by the setenv command if you use
csh(1). It is unwise to change certain sh(1) variables that are frequently exported by .profile files, such as MAIL, PS1, PS2, and IFS,
unless you know what you are doing.
PROGRAMMING
Programs can query and modify the environment, using the environment routines getenv(3), putenv(3), setenv(3) and unsetenv(3). Direct access
can be made through the global variable environ, though it is recommended that changes to the enviroment still be made through the environ-
ment routines.
Shared libraries and bundles don't have direct access to environ, which is only available to the loader ld(1) when a complete program is
being linked. The environment routines can still be used, but if direct access to environ is needed, the _NSGetEnviron() routine, defined in
<crt_externs.h>, can be used to retrieve the address of environ at runtime.
SEE ALSO
csh(1), ex(1), login(1), sh(1), getenv(3), putenv(3), setenv(3), unsetenv(3), execve(2), execle(3), system(3), termcap(3), terminfo(5)
HISTORY
The environ manual page appeared in 4.2BSD.
4.2 Berkeley Distribution April 19, 1994 4.2 Berkeley Distribution