![]() |
|
|
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 |
| ls and take each file as argument | melanie_pfefer | Shell Programming and Scripting | 3 | 01-24-2007 09:10 AM |
| argument help | brentdeback | Shell Programming and Scripting | 2 | 11-27-2005 03:53 PM |
| xldb WARNING: libC.a(ansi_32.o) has been stripped | Lazzar | High Level Programming | 2 | 01-05-2004 02:22 PM |
| Stripped install by floppy only. | Nietzsche | UNIX for Dummies Questions & Answers | 2 | 10-13-2002 10:11 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Stripped argument
Hi there Has anyone seen this behaviour before, and if so, do they know why this happens? I am running this in BASH: Code:
$ export DEV="/usr/sbin/diskutil list | /usr/bin/grep Master | /usr/bin/awk '{ print $6 }'"
$ echo $DEV
/usr/sbin/diskutil list | /usr/bin/grep Master | /usr/bin/awk '{ print }'
If you notice, the $6 argument has been stripped from the echo'd output. Mike |
|
||||
|
That's because the shell treat $6 as a commandline variable - it doesn't see the awk block and know it's an awk command: Code:
$ export DEV="/usr/sbin/diskutil list | /usr/bin/grep Master | /usr/bin/awk '{ print \$6 }'"
FWIW - what you want here is probably an alias unless you plan to : Code:
eval $DEV |
|
||||
|
mikie
I think its trying to expand the variable and since that variable is not intialized it is replacing it with a BLANK. see below dam@athena:~$ echo '{ print $6 }' { print $6 } dam@athena:~$ echo "'{ print $6 }'" '{ print }' not sure what the workaround is. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|