Penguin

Differences between version 4 and previous revision of HereStrings.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 4 Last edited on Saturday, December 9, 2006 11:20:40 pm by BenStaz Revert
Older page: version 1 Last edited on Saturday, December 9, 2006 11:08:15 pm by BenStaz Revert
@@ -2,23 +2,16 @@
 A variant of here documents, the format is: 
  
 *command <<< "string" 
  
-The string is supplied to the command on its standard input. Remember of course , that "string" can be replaced with a variable
+A here string uses a form of I/O redirection to feed a command to an *interactive* program or a command, such as ftp, cat, ex or read. This can be extremely handy
  
 I find Here String's very useful to easily assign values to multiple variables. 
  
-The 'read' command claims to read from the standard input, but it doesn't actually seem to happen when a pipe is involved. Each command in the pipeline gets executed in its own subshell and so the variables are set there and not passed back to the parent process. This is why  
-  
-*echo "red blue red" | read a b c  
-  
-DOES NOT WORK  
-  
-  
-How to get around this problem using Here Strings
+For Example
 *IFS=: ; read foo bar moo <<< "yellow:red:blue"; 
  
 Now try: 
  
 *echo $foo $bar $moo 
  
 and hopefully the value of the three variables will be displayed for you.