07-19-2012
With a long series of pipes it can be hard to trap and respond correctly to an error.
More pipes makes that harder to. Learn about the PIPESTATUS array if you want to write solid bash and use lots of pipes.
Some operations require pipes to become more efficient, e.g., pipes "cost" less disk space. And leave behind no intermediate files.
The book 'Code Complete' recommends that a line of code be split with continuation "\" when it gets beyond the max line length on your screen: ~80 character positions, including leading tabs and spaces. You can also split on a pipe symbol. This is to provide readability for the next guy.
10 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
I'm a frequent visitor to these forums. I generally enjoy topics that are posted as well as the responses. I really pickup a lot of new things to learn.
However, there is one thing that does bother me here. (I dont mean to start a flame war, or any problems at all, just expressing some... (8 Replies)
Discussion started by: tarballed
8 Replies
2. IP Networking
I have a series of new machines that are internet facing (have IP's that are accessible via the 'net) and it has internal facing interfaces. I need to be able to communicate back to the internal network to a specific server which processes monitoring and e-mail traffic. I've been told that I should... (3 Replies)
Discussion started by: BOFH
3 Replies
3. UNIX for Dummies Questions & Answers
My goal was to find any directories inside of any directory called "09_Client Original" not modified in the last 30 days.
$ find /Volumes/Jobs_Volume/ -type d -name "09_Client Original" -exec find {} -mtime +30 -type d -maxdepth 1 \;
The results of this find are passed along in a perl script... (1 Reply)
Discussion started by: guriboy
1 Replies
4. Shell Programming and Scripting
foll. is my code snippet.
#!/bin/ksh
retVal=`sqlplus -s user/passwd@oracle_sid <<EOF
SET SERVEROUTPUT ON SIZE 100000
DECLARE
STATUS_VALUE CHAR;
BEGIN
SELECT temp1 INTO STATUS_VALUE FROM sai;
DBMS_OUTPUT.PUT_LINE(STATUS_VALUE);
END;
/
SET... (1 Reply)
Discussion started by: sainathdeg
1 Replies
5. Shell Programming and Scripting
Hi,
Below is my script which creates a file:
#!/bin/sh
if
then
echo "Enter bill period "
echo "Syntax: sh cpd.sh G08"
exit
fi
sqlplus uname/pwd@dbname <<EOF
set WRAP off
set FEEDBACK off
set PAGESIZE 0
set VERIFY off (14 Replies)
Discussion started by: ss_ss
14 Replies
6. BSD
I'm learning UNIX on my mac (BSD), using a manual. I'm trying to figure out the grep command, and am getting something wrong. I've opened one of my files in NeoOffice and am looking for a string, the phrase 'I am writing.' I've been to some sites to get the proper syntax, and from what I can see... (5 Replies)
Discussion started by: Straitsfan
5 Replies
7. Shell Programming and Scripting
I have written a Bash Script that captures video via the Linux application DVgrab. When run my script prompts the terminal user to enter all the necessary information for the capture, save location, file name, file type capture duration etc...
These are all in the form of
#!/bin/bash
echo... (5 Replies)
Discussion started by: Starcast
5 Replies
8. UNIX for Dummies Questions & Answers
Hello,
On a linux server (centos 5.4), users upload file that should be flv. How can I check that the file is a real and proper flv file? Checking the extension is not enough!
Thanks (1 Reply)
Discussion started by: JCR
1 Replies
9. What is on Your Mind?
Recently i started to work in new company. I will replace old admin who is going into retirement and he has been showing me his procedures for server, database and network administration.
From first point of view: there is absolutely no configuration management involved how they deploy software... (0 Replies)
Discussion started by: solaris_user
0 Replies
10. Cybersecurity
Hey guys, not sure should I post it here or in 'What is on Your Mind?'
I'm discussing usage of DSL (domain specific language) in security tools with my colleagues. We haven't been able to reach an agreement over naming conventions.
There are many tools using DSL: splunk, sumologic,... (2 Replies)
Discussion started by: Tobby P
2 Replies
mknod(8) System Manager's Manual mknod(8)
NAME
mknod - Creates a special file
SYNOPSIS
/usr/sbin/mknod special_file [ b major_device# minor_device# | c major_device# minor_device#]
/usr/sbin/mknod filename p
DESCRIPTION
The mknod command makes a directory entry. The first argument is the name of the special device file. Select a name that is descriptive
of the device.
The mknod command has two forms. In the first form, the second argument is the b or c flag. The last two arguments are numbers specifying
the major_device, which helps the operating system find the device driver code, and the minor_device, the unit drive, or line number, which
may be either decimal or octal.
The assignment of major device numbers is specific to each system. You can determine the device numbers by examining the conf.c system
source file. If you change the contents of the conf.c file to add a device driver, you must rebuild the kernel.
In the second form of mknod, you use the p flag to create named pipes (FIFOs).
Only the superuser can create a character or device special file.
FLAGS
Indicates that the special file corresponds to a block-oriented device (disk or tape) Indicates that the special file corresponds to a
character-oriented device Creates named pipes (FIFOs)
EXAMPLES
To create the special file for a new drive, /dev/disk/dsk20, with a major device number of 1 and a minor device number of 2, enter: mknod
/dev/disk/dsk20 b 1 2 This command creates the special file, /dev/disk/dsk20, which is a block special file with major device number 1
and minor device number 2. To create a pipe named fifo, enter: mknod fifo p This command creates the pipe fifo, which is not necessarily
in the current directory.
FILES
Specifies the command path Specifies the system device numbers specification file delim off
mknod(8)