Very usable.  That looks like a winner.
Thanks!
  -G

----- Original Message -----
From: [email protected]
To: Eugene Schulman (BLOOMBERG/ 120 PARK), [email protected]
At: Dec 16 2013 16:28:54

  
Can you exclude any character from your input data to be used as a separator?
Then you could redefine the read separator (in the example below I used X):

  printf "\n\n\n\n\n" | IFS= read -dX FOO


Date: Mon, 16 Dec 2013 21:02:01 +0000
From: [email protected]
To: [email protected]
Subject: [ast-users] Raw command substitution "$()"

Hi guys,
I'm looking for a method to do raw command substitution.

The issue:
- Need a ksh93t+ / ksh93u facillity to be able to take the literal output of a 
command with no substitutions or omissions, where the substitute data is less 
than 1kB.  Target platforms are RHEL 6.4, Solaris 11 & AIX 7.1.

Examples.   printf is used below for illustration only.
- $(), command substitution, i.e. FOO=$(printf "\n\n\n\n\n");  seems unsuitable 
as it modifies the output by performing some whitespace handling, such as 
stripping newlines.  In this example, FOO returns zero-length.
- "$()", quoted, prevents the field splitting and pathname expansions, but 
doesn't protect the trailing whitespace.
- Binary read, i.e.   printf "\n\n\n\n\n" | read -N$length FOO;   works 
provided the $length of the read doesn't encounter the EOF, in this case values 
1-5.  If $length>5, in this example, FOO becomes zero-length.  For an input of 
unknown length, this feels impractical.
- One possible workaround is adding a suffix and then chopping it, i.e.  
FOO="$(printf "\n\n\n\n\nmysuffix")"; FOO="${FOO%mysuffix}"

Any advice on the best way to acquire the literal command output?

Thanks!    -G
_______________________________________________ ast-users mailing list 
[email protected] 
http://lists.research.att.com/mailman/listinfo/ast-users
_______________________________________________
ast-users mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-users

Reply via email to