![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read command | COD | Shell Programming and Scripting | 4 | 04-26-2008 01:49 PM |
| help with READ command | fiol73 | UNIX for Dummies Questions & Answers | 2 | 12-15-2006 11:13 AM |
| Read Command | Woodbird25 | UNIX for Dummies Questions & Answers | 2 | 03-10-2004 02:06 PM |
| Cat and read command | mango | Shell Programming and Scripting | 3 | 12-29-2003 10:55 AM |
| while using read command I want too..... | nhatch | UNIX for Dummies Questions & Answers | 1 | 08-08-2002 05:19 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
'Morning
Code:
vmstat 1 1|sed 1,2d|awk '{printf("%s\n",$1)}'|read var
echo $var
I think that problem is the read command, because the following syntax is ok : Code:
vmstat 1 1|sed 1,2d|awk '{printf("%s\n",$1)}'
regards nymus |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Strange, you syntax seems to be fine! I am checking the man page for bash on the net, you should not be getting an error. Just to check, can you skip the "\n" in the awk?
|
|
#3
|
|||
|
|||
|
Yeah strange, I'm getting any errors! the echo command send me only a blank line...
I've just skipping the "\n" in the awk but it's the same result! Thanks for your help nymus |
|
#4
|
|||
|
|||
|
I've made new test:
This syntax doesn't run: Code:
vmstat 1 1|sed 1,2d|awk '{printf("%s\n",$1)}'|read var
echo $var
Code:
vmstat 1 1 |sed 1,2d |awk '{printf("%s\n",$1) }'|read var;echo $var
Thx |
|
#5
|
||||
|
||||
|
FYI. From BASH Frequently-Asked Questions
Quote:
|
|
#6
|
|||
|
|||
|
Thanks for your reply!
But my script doesn't run with new syntax : read var << echo $(vmstat 1 1 |...) I've read on the bash manuel that the read command is a "Bash Builtin Commands" and should running like in other shell. What's that means? Is bash a restrictive shell...? I'll must to change all my AIX scripts for my linux box :-( really a bad things Regards,ny |
|
#7
|
||||
|
||||
|
Hey r2007, thanks for that FAQ. But this works just fine from ksh. Maybe it has something to do with the manner in which forks are called by the shell..
|
||||
| Google The UNIX and Linux Forums |