Visit Our UNIX and Linux User Community


how much we can pipe in shell prompt ?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how much we can pipe in shell prompt ?
# 1  
Old 09-18-2009
Data how much we can pipe in shell prompt ?

Hi All experts, I was asked some questions of late & i was not aware of these. 1Q. how much we can pipe in shell prompt ?2Q. how many arguments we can pass in shell script & how to print that ? (eg, if i want to know what I passed in 11th Argument) ( for 3rd argument we can do echo $3, but I think for 11th Arg it can't done same way)3Q. I want to create a directory dir1 and then dir2 in side dir1 and then dirr3 inside dir2, ie, dir1/dir2/dir3 by a single command. How ?Thanking you in anticipation,
# 2  
Old 09-18-2009
what do you mean by how much ??? in question 1..
echo $11 will print 11th argument like echo $3
mkdir -p dir1/dir2/dir3
# 3  
Old 09-18-2009
Question

Quote:
Originally Posted by vidyadhar85
what do you mean by how much ??? in question 1..
echo $11 will print 11th argument like echo $3
mkdir -p dir1/dir2/dir3
by 'how much' I meant how many times. eg, echo "hello unix.com" | cut -f1 -d"." | grep 'unix' , here I used pipe twice. like wise can I pipe 50 or 60 or may be 100 times,eg, some command | some command | ........ 'n' times ........ | some command
# 4  
Old 09-18-2009
There's no arbitrary limit beyond whatever limit your system has for how many processes one user is allowed to create, how much memory one user is allowed to use, and how many pipes the kernel can keep around at once. You'd probably be allowed a few dozen at minimum before the system started refusing you, depending on what the processes actually are and what limits your sysop has set.

But that doesn't make it a good idea. Joining dozens of processes in a pipe-chain would be very inefficient since each one would need to take turns running and reading and writing. What is the goal here? There's probably a better way to do it.
# 5  
Old 09-18-2009
If there is a limit, it's a quite large one. Example taken from Randall Munroe:
Code:
cat /usr/share/dict/words | fgrep -v "'" | \
perl -ne 'chomp($_); @b=split(//,$_); print join("", sort(@b))." ".$_."\n";' | \
tee lookup.txt | perl -pe 's/^([^ ]+) .*/\1/g' | awk '{ print length, $0 }' | \
sort -n | awk '{$1=""; print $0}' | uniq -c | sort -nr | egrep "^[^0-9]+2 " | \
awk '{ print length, $0 }' | sort -n | awk '{$1=""; print $0}' | \
perl -pe 's/[ 0-9]//g' | xargs -i grep {} lookup.txt | perl -pe 's/[^ ]+ //g' |\
tail -n2

# 6  
Old 09-18-2009
Data

Quote:
Originally Posted by Corona688
There's no arbitrary limit beyond whatever limit your system has for how many processes one user is allowed to create, how much memory one user is allowed to use, and how many pipes the kernel can keep around at once. You'd probably be allowed a few dozen at minimum before the system started refusing you, depending on what the processes actually are and what limits your sysop has set.

But that doesn't make it a good idea. Joining dozens of processes in a pipe-chain would be very inefficient since each one would need to take turns running and reading and writing. What is the goal here? There's probably a better way to do it.
Today in a interview a senior person asked me this and I was not sure about the answenrs. I should have posted these questions yesterday Smilie
# 7  
Old 09-19-2009
Remember to use the syntax ${1} and ${11} rather than $1 and $11 when composing strings.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #457
Difficulty: Easy
NTP was created to synchronize all participating computers to within a few milliseconds of Coordinated Universal Time (UTC).
True or False?

9 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

How to create one's own pipe in one's own shell?

Good evening, I'm trying to do my own shell and I encountered some issues while creating it. Indeed when I try such a command I have DAUPHINE> DAUPHINE> ls -l | grep terminal > fichier DAUPHINE> cat fichier My shell is named DAUPHINE Whereas I should have: Code: ... (0 Replies)
Discussion started by: AntoineCompagni
0 Replies

2. Shell Programming and Scripting

RFC - Korn shell prompt

Hi, I am learning shell scripting for the first time. I use AT&T Korn Shell, Version AJM 93u+ 2012-08-01, compiled from source on NetBSD. So far I have managed to set up what I think is a useful and pleasing shell prompt, which can be seen in the image attached to this post. The prompt is... (2 Replies)
Discussion started by: gezley
2 Replies

3. AIX

Shell Scripting (prompt off)

Dear all experts, I have a script written to compress a list of files, during compressing, some of the files are having same name. When the compressing started, the same name file will be prompted with message whether to overwrite the old file. I need to enter "y" to continue. Is there any way I... (7 Replies)
Discussion started by: kwliew999
7 Replies

4. Shell Programming and Scripting

Changing the shell prompt

Hi, I want to change the shell prompt, using the cd command. I have a shell prompt like this - p78-mfx(dgaw1078/9781)$ Now i do this - p78-mfx(dgaw1078/9781)$ cd log4j here the shell prompt should change like this - p78-mfx(dgaw1078/9781)log4j$ (6 Replies)
Discussion started by: arunkumarmc
6 Replies

5. Shell Programming and Scripting

Interactive shell through a pipe

I'm new to working with pipes, so I don't know whether the following is expected behaviour or a bug on the part of an application. Since Version 0.47, Inkscape provides a non-GUI interactive shell mode of operation. I am trying to time the program's performance in converting SVG files to PNG... (1 Reply)
Discussion started by: ccprog
1 Replies

6. UNIX for Advanced & Expert Users

Weird in Shell Prompt

Hi, I saw something in weird in Shell prompt. I did the following steps 1) Typed ls -l and pressed ESC without entering 2) Typed "v" (please notice that I did not type "i" after "v"), which opened vi editor 3) I see the "ls -l" command that I typed in shell prompt 4) Without modifying... (6 Replies)
Discussion started by: bobbygsk
6 Replies

7. UNIX for Dummies Questions & Answers

shell specific prompt

currently, I set my prompt in my .cshrc file as: set prompt = "%B%h %m %P %/ \n% " I have to use certain shells for some specific tasks and would like to set different prompts depending on the type of shell that I am using. Any advice? Thanks (3 Replies)
Discussion started by: dranNfly
3 Replies

8. UNIX for Dummies Questions & Answers

prompt in sh shell

Hi, Im using SCO Unix 5.0.5 and I want to configure de variable PS1, so when I type the command: cd /etc/ the prompt shows /etc/_> Is that possible with sh shell? Ill appreciate your help. Thanks, a Happy New Year! (1 Reply)
Discussion started by: diegoe
1 Replies

9. UNIX for Dummies Questions & Answers

No shell prompt?

When I login to a specific machine (running Solaris 2.8; actually serveral machines behave this way), with a known good account, I don't get any shell prompt, and no screen responses to various commands such as ID and PWD. Any ideas on what is causing this, and how to change this behavior? (2 Replies)
Discussion started by: Mufasa
2 Replies

Featured Tech Videos