Fdisk Call internals script?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fdisk Call internals script?
# 1  
Old 01-22-2010
Fdisk Call internals script?

I'm using
Code:
fdisk -l > myFile

to get the file size of the device in a file where I want the output

but one line always go to the terminal and make my interface look ugly:

Disk /dev/sda doesn't contain a valid partition table

How do I stop this line from going to the command line with a device that does not have a valid partition table, because my program requires it to not have a valid one? Is fdisk calling another script?

Last edited by darkstarxor; 01-23-2010 at 08:14 PM..
# 2  
Old 01-22-2010
Hi.

Perhaps the line to which you refer is output to standard error.

So, depending on what you want to do with it, you can:

a) get rid of it
Code:
fdisk -l > myFile 2>/dev/null

b) put it in myFile with the other output
Code:
fdisk -l > myFile 2>&1

# 3  
Old 01-23-2010
Yes, that works. I read about standard error a few years back, and totally forgot about it. Thanks. Now my interface is b-e-a-u-tiful.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

How to switch from SVR4/BSD internals to Linux internals?

Hello, Long-time Unix hacker here - I've worked on four variants of the kernel prior to the introduction of Linux. In my spare time, I've written Linux (Ubuntu) device drivers, kernel modules, cross-compiled, and built the kernel. I'd like to do Linux internals/device drivers as a day job,... (1 Reply)
Discussion started by: OriginalVersion
1 Replies

2. BSD

OpenBSD fdisk - Linux fdisk compatibility ?

Hello, MBR partition table made by linux fdisk looks certainly not correct when printed by openbsd fdisk: Partition table created on linux (centos 6.3): # fdisk -l /dev/sdc Disk /dev/sdc: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders Units = cylinders of 16065 *... (2 Replies)
Discussion started by: vilius
2 Replies

3. Shell Programming and Scripting

Non-interactive fdisk partition in script

Hi, How can I run fdisk partition in a script without interactive input? In manual procedure, I run fdisk device, select n, select p, presess enter for default start number (1), press enter to default end number, then select w for writing to the partition table. The command looks like... (3 Replies)
Discussion started by: hce
3 Replies

4. UNIX for Advanced & Expert Users

GDB Breakpoint Internals

When we put a breakpoint using gcc then what all things happen internally and how the gdb using break is able to pause the execution of process( instead of killing it ) and later on resume the process execution? (0 Replies)
Discussion started by: rupeshkp728
0 Replies

5. Programming

Internals of the printf function?

hey all, im a new programmer. i was wondering how you would go about writing the printf function yourself? it is my understanding that when you call printf you are calling an already written function and just providing an argument? if this is the case, is it possible to write that function... (8 Replies)
Discussion started by: Christian.B
8 Replies

6. Programming

Need more info on internals of c compilers

Hello Gurus, i am ok with the concepts of c language but i would like to know more about the internals of c with respect to the compilers what happens when we say gcc filename.c the a.out will get created(what actaully compiler does to the code inaddition to generating object code) ... (5 Replies)
Discussion started by: MrUser
5 Replies

7. Programming

UNIX Internals, Help required...

I know UNIX user level commands, shell scripts. But i have no idea about kernel level programming and networking. I know the terms semaphore,IPC,socket programming. But i don't know in details what are these. I need to know the following. 1. Unix kernel level programming. 2. Unix Internals. 3.... (4 Replies)
Discussion started by: digdarshan
4 Replies

8. HP-UX

HP-UX Internals Book

. (2 Replies)
Discussion started by: Driver
2 Replies

9. Filesystems, Disks and Memory

on unix internals

will anybody tell me how can i access all the fields of process table .if there is any structure and a system call please specify . (1 Reply)
Discussion started by: vish_shan
1 Replies

10. New to Unix. Which books should I read?

UniX internals Material

Hi! I have 1.5 years experience in unix environment and shell scripting. Now, I started learning UNIX internals and network programming. Can you please help in finding the same material on the net Thanks Srinivas. (7 Replies)
Discussion started by: srinivaskathika
7 Replies
Login or Register to Ask a Question