Sponsored Content
Full Discussion: Proper syntax
Top Forums UNIX for Dummies Questions & Answers Proper syntax Post 302674283 by jrymer on Thursday 19th of July 2012 10:13:28 AM
Old 07-19-2012
Proper syntax

I'm new to Unix, and just had a quick question.

I'm writing a bash script, and I was wondering what proper programming etiquette was for piping. How many pipes is too many pipes?
Code:
OLDEST=$(find . -maxdepth 1 -type d -newermt 2012-07-01 ! -newermt
2012-07-30 | xargs ls -1td | tail -2)

echo "${OLDEST}\n"

My next step would be to tar those directories, then move them. I'm not asking if it's a matter of CAN I pipe it all, but SHOULD I pipe it all. As its proper to indent while in a loop, is there a unanimous rule for amount of pipes?

Thanks
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Proper Forum Etiquette

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

Proper routing

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

Proper use of prune...

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

getting proper o/p from a procedure in a script

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

proper ordering of o/p values

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

proper syntax of grep command

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

Help with proper loop and variables

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

check file is a proper flv

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?

Proper configuration management

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

Proper naming conventions

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
pipe(2) 							System Calls Manual							   pipe(2)

NAME
pipe() - create an interprocess channel SYNOPSIS
DESCRIPTION
creates an I/O mechanism called a pipe and returns two file descriptors, fildes[0] and fildes[1]. fildes[0] is opened for reading and fildes[1] is opened for writing. A read-only file descriptor fildes[0] accesses the data written to fildes[1] on a first-in-first-out (FIFO) basis. For details of the I/O behavior of pipes see read(2) and write(2). By default, HP-UX pipes are not STREAMS-based. It is possible to generate the kernel so that all pipes created on a system are STREAMS- based. This can only be done for HP-UX releases 10.0 and later. STREAMS-based FIFOs (created by or are not supported on HP-UX. To generate a kernel that supports STREAMS-based pipes: o STREAMS/UX must be installed. o The module and the driver must be included in the file. (When STREAMS/UX is installed, and are automatically added to the system file.) o The tunable parameter (see streampipes(5)) must be set to 1 in the file. (This is not automatically done when STREAMS/UX is installed.) o The kernel must be generated and the system rebooted. Once this is done, all pipes created by will be STREAMS-based. For more information, see EXAMPLES
The following example uses to implement the command string RETURN VALUE
returns one of the following values: Successful completion. Failure. is set to indicate the error. ERRORS
sets to one of the following error values if the corresponding condition is true. or more file descriptors are currently open. The system file table is full. The file system lacks sufficient space to create the pipe. Could not allocate resources for both Stream heads (STREAMS-based pipes only). SEE ALSO
sh(1), read(2), write(2), popen(3S), privileges(5), streampipes(5), streamio(7). STANDARDS CONFORMANCE
pipe(2)
All times are GMT -4. The time now is 06:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy