Sponsored Content
Top Forums Shell Programming and Scripting Change to directory and search some file in that directory in single command Post 302758995 by Scrutinizer on Monday 21st of January 2013 07:12:41 AM
Old 01-21-2013
Try replacing the first pipe by a semicolon.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Change directory command (cd)

I want to limit the directories that a user can access. When this users logs in, I do not want them to cd to any directory but those in their $HOME. In other words: login: pwd: /home/user cd / -- user tries to cd to root directory. pwd /home/user -- user is still in home... (4 Replies)
Discussion started by: oscarr
4 Replies

2. Shell Programming and Scripting

search in a directory using grep command

Hi, I want to search files/directories in /temp directory which starts with letter 'a'. How can I do that using grep command. I can find out like ls -ltr a* but I want to use grep command like ls -ltr | grep ..... like that. Please help. Malay (4 Replies)
Discussion started by: malaymaru
4 Replies

3. UNIX for Dummies Questions & Answers

Unix find command to print directory and search string

Hi i need to print pathname in which the string present using 'find' command sample output like this Pathname String to be searched ---------- -------------------- /usr/test/myfile get /opt/test/somefile get Thanks in... (4 Replies)
Discussion started by: princein
4 Replies

4. UNIX for Advanced & Expert Users

whats command for search including sub directory ?

What is the command for search the program name from the entire directory (all directories in the unix box, means including sub directories...) (2 Replies)
Discussion started by: gksenthilkumar
2 Replies

5. Shell Programming and Scripting

Change directory command (cd)

What's wrong with this script????? Please help!!! !#/bin/sh echo "please enter dir" read input cd $input I'm trying to make a simple script to change dir. But does not work. it stays at the same dir where i run the script. What did i do wrong?? (21 Replies)
Discussion started by: c00kie88
21 Replies

6. Shell Programming and Scripting

CD (change directory) - Not advisable for executing a command

Hi, This is a quick one. I have got a review comment in one of the scripts that i wrote: "In UNIX script it not advisable to use cd to a directory and then run command." Is this true? I was trying to cd to log directory and use some cat or head or ls command. Many Thanks, Sam (2 Replies)
Discussion started by: samplify
2 Replies

7. Homework & Coursework Questions

Single command to delete a directory

Use and complete the template provided. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a command that will delete the john directory, and all of its contents. The problem I can't firgure out is how to create a absoute path to... (5 Replies)
Discussion started by: jorogon0099
5 Replies

8. Shell Programming and Scripting

how to find first files in a directory and combine them as a single file?

i have below list of files in a directory. /root/admin/files/file1.txt /root/admin/files/file2.txt /root/admin/files/file3.txt /root/admin/files/pattern.txt /root/admin/files/server.txt i need combine the above text files in the below sequence, file1.txt, pattern.txt,server.txt =>... (8 Replies)
Discussion started by: vel4ever
8 Replies

9. UNIX for Dummies Questions & Answers

How to change database directory to another directory?

Hi, I Installed mysql on my CentOS 6.2 Server. But when I tried to change the location of /var/lib/mysql to another directory. I can't start the mysql. Below is what I've done yum install mysql mysql-server mysql-devel mkdir /path/to/new/ cp -R /var/lib/mysql /path/to/new chown -R... (1 Reply)
Discussion started by: ganitolngyundre
1 Replies

10. Shell Programming and Scripting

Move multiple files to different directory using a single command

I have multiple files test1, test2, test3 etc. I want to move to a different directory with ABC_ prefixed to every file and and current dat time as postfix using a single command. (I will be using this is sftp with ! (command for local server). I have tried the following but it gives error ... (5 Replies)
Discussion started by: Soham
5 Replies
pipe(2) 							   System Calls 							   pipe(2)

NAME
pipe - create an interprocess channel SYNOPSIS
#include <unistd.h> int pipe(int fildes[2]); DESCRIPTION
The pipe() function creates an I/O mechanism called a pipe and returns two file descriptors, fildes[0] and fildes[1]. The files associated with fildes[0] and fildes[1] are streams and are both opened for reading and writing. The O_NDELAY, O_NONBLOCK, and FD_CLOEXEC flags are cleared on both file descriptors. The fcntl(2) function can be used to set these flags. A read from fildes[0] accesses the data written to fildes[1] on a first-in-first-out (FIFO) basis and a read from fildes[1] accesses the data written to fildes[0] also on a FIFO basis. Upon successful completion pipe() marks for update the st_atime, st_ctime, and st_mtime fields of the pipe. RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The pipe() function will fail if: EMFILE More than {OPEN_MAX} file descriptors are already in use by this process. ENFILE The number of simultaneously open files in the system would exceed a system-imposed limit. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), fcntl(2), fstat(2), getmsg(2), poll(2), putmsg(2), read(2), write(2), attributes(5), standards(5), streamio(7I) NOTES
Since a pipe is bi-directional, there are two separate flows of data. Therefore, the size (st_size) returned by a call to fstat(2) with argument fildes[0] or fildes[1] is the number of bytes available for reading from fildes[0] or fildes[1] respectively. Previously, the size (st_size) returned by a call to fstat() with argument fildes[1] (the write-end) was the number of bytes available for reading from fildes[0] (the read-end). SunOS 5.11 23 Apr 2002 pipe(2)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy