Penguin

Differences between version 8 and predecessor to the previous major change of HereStrings.

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

Newer page: version 8 Last edited on Monday, December 11, 2006 1:57:45 am by BenStaz Revert
Older page: version 6 Last edited on Sunday, December 10, 2006 8:24:21 am by GreigMcGill Revert
@@ -1,6 +1,6 @@
 !Here Strings 
-A variant of here documents, the format is: 
+A variant of [Here Documents|HereDocuments] the format is: 
  
 *command <<< "string" 
  
 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. So basically those apps you run that allow user input can be automatically fed strings rather than you typing them! 
@@ -14,4 +14,10 @@
  
 *echo $foo $bar $moo 
  
 and hopefully the value of the three variables will be displayed for you. 
+  
+!Read from a variable  
+Make sure the variable is surrounded by double quotes!  
+  
+*string="this:is:a:string"; IFS=: ; read foo bar moo cow <<< "$string"  
+*echo $foo $bar $moo $cow