![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VI Substitution problem | gravy26 | AIX | 7 | 02-13-2008 04:12 PM |
| Bash: bad substitution problem...pls help! | xfouxs | UNIX for Dummies Questions & Answers | 1 | 11-23-2007 05:48 PM |
| Define an alias with an embeded awk command ?? | jfortes | Shell Programming and Scripting | 5 | 06-05-2007 01:03 PM |
| Substitution problem. | er_ashu | Shell Programming and Scripting | 3 | 04-03-2007 07:48 AM |
| Substitution of last command | ghazi | Shell Programming and Scripting | 6 | 01-16-2005 07:06 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
problem in embeded command substitution
$ echo $(tty|sed 's#/[a-z]*/##')
pts/0 $ who | grep $(tty|sed 's#/[a-z]*/##') grep: 0652-033 Cannot open 0551-011. grep: 0652-033 Cannot open Standard. grep: 0652-033 Cannot open input. grep: 0652-033 Cannot open is. grep: 0652-033 Cannot open not. grep: 0652-033 Cannot open a. grep: 0652-033 Cannot open tty.. $ does anybody know why the command substitution gots error here? does any rule forbid the command substitution in pipeline? thanks in advance! |
|
||||
|
Because it's in a pipeline, tty is not connected to your terminal.
You can work around it by running tty first, and then grepping. Code:
tty=$(tty | sed 's#/[a-z]*/##') who | grep "$tty" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|