The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 09-28-2006
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,426
The value of the variable EXP is specified between ", so the shell interprets the value before affectation.
$6 is replaced by the value of argument 6 which seems to be be not set in your case.

Protect $6 with \ to avoid substitution:
Code:
export DEV="/usr/sbin/diskutil list | /usr/bin/grep Master | /usr/bin/awk '{ print \$6 }'"
or use simple quotes ', in that case internals simple quotes must be protected :
Code:
export DEV='/usr/sbin/diskutil list | /usr/bin/grep Master | /usr/bin/awk \'{ print $6 }\''

Jean-Pierre.